home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 4 / QRZ Ham Radio Callsign Database - Volume 4.iso / files / dsp / 56ktools / dspkgctr.z / dspkgctr / gcc / optabs.c < prev    next >
C/C++ Source or Header  |  1992-06-08  |  70KB  |  2,495 lines

  1. /* Expand the basic unary and binary arithmetic operations, for GNU compiler.
  2.    Copyright (C) 1987, 1988 Free Software Foundation, Inc.
  3.  
  4.    $Id: optabs.c,v 1.11 92/03/31 21:32:19 pete Exp $
  5.  
  6. This file is part of GNU CC.
  7.  
  8. GNU CC is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 1, or (at your option)
  11. any later version.
  12.  
  13. GNU CC is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with GNU CC; see the file COPYING.  If not, write to
  20. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22.  
  23. #include "config.h"
  24. #include "rtl.h"
  25. #include "tree.h"
  26. #include "flags.h"
  27. #if ! defined( _INTELC32_ )
  28. #include "insn-flags.h"
  29. #include "insn-codes.h"
  30. #else
  31. #include "iflags.h"
  32. #include "icodes.h"
  33. #endif
  34. #include "expr.h"
  35. #if ! defined( _INTELC32_ )
  36. #include "insn-config.h"
  37. #else
  38. #include "iconfig.h"
  39. #endif
  40. #include "recog.h"
  41.  
  42. /* In ANSI C we could write MODE + 1, but traditional C compilers
  43.    seem to reject it.  */
  44. #define INC_MODE(MODE) (enum machine_mode) ((int)(MODE) + 1)
  45.  
  46. /* Each optab contains info on how this target machine
  47.    can perform a particular operation
  48.    for all sizes and kinds of operands.
  49.  
  50.    The operation to be performed is often specified
  51.    by passing one of these optabs as an argument.
  52.  
  53.    See expr.h for documentation of these optabs.  */
  54.  
  55. optab add_optab;
  56. optab sub_optab;
  57. optab smul_optab;
  58. optab umul_optab;
  59. optab smul_widen_optab;
  60. optab umul_widen_optab;
  61. optab sdiv_optab;
  62. optab sdivmod_optab;
  63. optab udiv_optab;
  64. optab udivmod_optab;
  65. optab smod_optab;
  66. optab umod_optab;
  67. optab flodiv_optab;
  68. optab ftrunc_optab;
  69. optab and_optab;
  70. optab andcb_optab;
  71. optab ior_optab;
  72. optab xor_optab;
  73. optab ashl_optab;
  74. optab lshr_optab;
  75. optab lshl_optab;
  76. optab ashr_optab;
  77. optab rotl_optab;
  78. optab rotr_optab;
  79.  
  80. optab mov_optab;
  81. optab movstrict_optab;
  82.  
  83. optab neg_optab;
  84. optab abs_optab;
  85. optab one_cmpl_optab;
  86. optab ffs_optab;
  87.  
  88. optab cmp_optab;
  89. optab ucmp_optab;  /* Used only for libcalls for unsigned comparisons.  */
  90. optab tst_optab;
  91.  
  92. /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
  93.    gives the gen_function to make a branch to test that condition.  */
  94.  
  95. rtxfun bcc_gen_fctn[NUM_RTX_CODE];
  96.  
  97. /* Indexed by the rtx-code for a conditional (eg. EQ, LT,...)
  98.    gives the gen_function to make a store-condition insn
  99.    to test that condition.  */
  100.  
  101. rtxfun setcc_gen_fctn[NUM_RTX_CODE];
  102.  
  103. /* Generate code to perform an operation specified by BINOPTAB
  104.    on operands OP0 and OP1, with result having machine-mode MODE.
  105.  
  106.    UNSIGNEDP is for the case where we have to widen the operands
  107.    to perform the operation.  It says to use zero-extension.
  108.  
  109.    If TARGET is nonzero, the value
  110.    is generated there, if it is convenient to do so.
  111.    In all cases an rtx is returned for the locus of the value;
  112.    this may or may not be TARGET.  */
  113.  
  114. rtx
  115. expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
  116.      enum machine_mode mode;
  117.      optab binoptab;
  118.      rtx op0, op1;
  119.      rtx target;
  120.      int unsignedp;
  121.      enum optab_methods methods;
  122. {
  123.   enum mode_class class;
  124.   enum machine_mode wider_mode;
  125.   register rtx temp;
  126.   rtx last;
  127.  
  128.   class = GET_MODE_CLASS (mode);
  129.  
  130.   op0 = protect_from_queue (op0, 0);
  131.   op1 = protect_from_queue (op1, 0);
  132.   if (target)
  133.     target = protect_from_queue (target, 1);
  134.  
  135. #if 0
  136.   /* We may get better code by generating the result in a register
  137.      when the target is not one of the operands.  */
  138.   if (target && ! rtx_equal_p (target, op1) && ! rtx_equal_p (target, op0))
  139.     target_is_not_an_operand = 1;
  140. #endif
  141.  
  142.   if (flag_force_mem)
  143.     {
  144.       op0 = force_not_mem (op0);
  145.       op1 = force_not_mem (op1);
  146.     }
  147.  
  148.   /* Record where to delete back to if we backtrack.  */
  149.   last = get_last_insn ();
  150.  
  151.   /* If operation is commutative,
  152.      try to make the first operand a register.
  153.      Even better, try to make it the same as the target.
  154.      Also try to make the last operand a constant.  */
  155. #if defined( DSP56000 ) || defined( DSP96000 )
  156.   /* although addition is commutative, swapping operands on a pointer add
  157.    * will cause gcc to do mode mungeing on the operands and we'll probably
  158.    * get an abort when something tries to do a (SUBREG:SI (REG:PSI)).
  159.    */
  160.   if ((( binoptab == add_optab ) && (( Pmode == SImode ) || Pmode != mode ))
  161. #else
  162.   if (binoptab == add_optab
  163. #endif
  164.       || binoptab == and_optab
  165.       || binoptab == ior_optab
  166.       || binoptab == xor_optab
  167.       || binoptab == smul_optab
  168.       || binoptab == umul_optab
  169.       || binoptab == smul_widen_optab
  170.       || binoptab == umul_widen_optab)
  171.     {
  172.       if (((target == 0 || GET_CODE (target) == REG)
  173.        ? ((GET_CODE (op1) == REG
  174.            && GET_CODE (op0) != REG)
  175.           || target == op1)
  176.        : rtx_equal_p (op1, target))
  177.       ||
  178.       GET_CODE (op0) == CONST_INT)
  179.     {
  180.       temp = op1;
  181.       op1 = op0;
  182.       op0 = temp;
  183.     }
  184.     }
  185.  
  186.   /* If we can do it with a three-operand insn, do so.  */
  187.  
  188.   if (methods != OPTAB_MUST_WIDEN
  189.       && binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  190.     {
  191.       int icode = (int) binoptab->handlers[(int) mode].insn_code;
  192.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  193.       enum machine_mode mode1 = insn_operand_mode[icode][2];
  194.       rtx pat;
  195.       rtx xop0 = op0, xop1 = op1;
  196.  
  197.       if (target)
  198.     temp = target;
  199.       else
  200.     temp = gen_reg_rtx (mode);
  201.  
  202.       /* In case the insn wants input operands in modes different from
  203.      the result, convert the operands.  */
  204.  
  205.       if (GET_MODE (op0) != VOIDmode
  206.       && GET_MODE (op0) != mode0)
  207.     xop0 = convert_to_mode (mode0, xop0, unsignedp);
  208.  
  209.       if (GET_MODE (xop1) != VOIDmode
  210.       && GET_MODE (xop1) != mode1)
  211.     xop1 = convert_to_mode (mode1, xop1, unsignedp);
  212.  
  213.       /* Now, if insn requires register operands, put operands into regs.  */
  214.  
  215.       if (! (*insn_operand_predicate[icode][1]) (xop0, mode0))
  216.     xop0 = force_reg (mode0, xop0);
  217.  
  218.       if (! (*insn_operand_predicate[icode][2]) (xop1, mode1))
  219.     xop1 = force_reg (mode1, xop1);
  220.  
  221.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  222.     temp = gen_reg_rtx (mode);
  223.  
  224.       pat = GEN_FCN (icode) (temp, xop0, xop1);
  225.       if (pat)
  226.     {
  227.       emit_insn (pat);
  228.       return temp;
  229.     }
  230.       else
  231.     delete_insns_since (last);
  232.     }
  233.  
  234.   /* It can't be open-coded in this mode.
  235.      Use a library call if one is available and caller says that's ok.  */
  236.  
  237.   if (binoptab->handlers[(int) mode].lib_call
  238.       && (methods == OPTAB_LIB || methods == OPTAB_LIB_WIDEN))
  239.     {
  240.       rtx insn_before, insn_first, insn_last;
  241.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  242.                 binoptab->handlers[(int) mode].lib_call);
  243.  
  244.       /* Pass the address through a pseudoreg, if desired,
  245.      before the "beginning" of the library call.
  246.      So this insn isn't "part of" the library call, in case that
  247.      is deleted, or cse'd.  */
  248. #ifndef NO_FUNCTION_CSE
  249.       if (! flag_no_function_cse)
  250.     funexp = copy_to_mode_reg (Pmode, funexp);
  251. #endif
  252.  
  253.       insn_before = get_last_insn ();
  254.       if (insn_before == 0)
  255.     abort ();
  256.  
  257.       /* Cannot pass FUNEXP since emit_library_call insists
  258.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  259.      be replaced with the copy we made just above.  */
  260.       /* Pass 1 for NO_QUEUE so we don't lose any increments
  261.      if the libcall is cse'd or moved.  */
  262.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  263.                   binoptab->handlers[(int) mode].lib_call),
  264.              1, mode, 2, op0, mode, op1, mode);
  265.       target = hard_libcall_value (mode);
  266.       temp = copy_to_reg (target);
  267.  
  268.       insn_first = NEXT_INSN (insn_before);
  269.       insn_last = get_last_insn ();
  270.  
  271.       REG_NOTES (insn_last)
  272.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  273.            gen_rtx (binoptab->code, mode, op0, op1),
  274.            gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  275.                 REG_NOTES (insn_last)));
  276.       REG_NOTES (insn_first)
  277.     = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  278.            REG_NOTES (insn_first));
  279.       return temp;
  280.     }
  281.  
  282.   delete_insns_since (last);
  283.  
  284.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  285.  
  286.   if (! (methods == OPTAB_WIDEN || methods == OPTAB_LIB_WIDEN
  287.      || methods == OPTAB_MUST_WIDEN))
  288.     return 0;            /* Caller says, don't even try.  */
  289.  
  290.   /* Compute the value of METHODS to pass to recursive calls.
  291.      Don't allow widening to be tried recursively.  */
  292.  
  293.   methods = (methods == OPTAB_LIB_WIDEN ? OPTAB_LIB : OPTAB_DIRECT);
  294.  
  295.   /* Widening is now independent of specific machine modes.
  296.      It is assumed that widening may be performed to any
  297.      higher numbered mode in the same mode class.  */
  298.  
  299.   if (class == MODE_INT || class == MODE_FLOAT)
  300.     {
  301.       for (wider_mode = INC_MODE (mode);
  302.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  303.         && GET_MODE_CLASS (wider_mode) == class);
  304.        wider_mode = INC_MODE (wider_mode))
  305.     {
  306.       if ((binoptab->handlers[(int) wider_mode].insn_code
  307.            != CODE_FOR_nothing)
  308.           || (methods == OPTAB_LIB
  309.           && binoptab->handlers[(int) wider_mode].lib_call))
  310.         {
  311.           rtx xop0 = op0, xop1 = op1;
  312.           int no_extend = 0;
  313.  
  314.           /* For certain operations, we need not actually extend
  315.          the narrow operands, as long as we will truncate
  316.          the results to the same narrowness.  */
  317.  
  318.           if (binoptab == ior_optab || binoptab == and_optab
  319.           || binoptab == xor_optab || binoptab == andcb_optab
  320.           || binoptab == add_optab || binoptab == sub_optab
  321.           || binoptab == smul_optab || binoptab == umul_optab
  322.           || binoptab == ashl_optab || binoptab == lshl_optab)
  323.         no_extend = 1;
  324.  
  325.           if (GET_MODE (xop0) != VOIDmode)
  326.         {
  327.           if (no_extend)
  328.             {
  329.               temp = force_reg (GET_MODE (xop0), xop0);
  330.               xop0 = gen_rtx (SUBREG, wider_mode, temp, 0);
  331.             }
  332.           else
  333.             {
  334.               temp = gen_reg_rtx (wider_mode);
  335.               convert_move (temp, xop0, unsignedp);
  336.               xop0 = temp;
  337.             }
  338.         }
  339.           if (GET_MODE (xop1) != VOIDmode)
  340.         {
  341.           if (no_extend)
  342.             {
  343.               temp = force_reg (GET_MODE (xop1), xop1);
  344.               xop1 = gen_rtx (SUBREG, wider_mode, temp, 0);
  345.             }
  346.           else
  347.             {
  348.               temp = gen_reg_rtx (wider_mode);
  349.               convert_move (temp, xop1, unsignedp);
  350.               xop1 = temp;
  351.             }
  352.         }
  353.  
  354.           temp = expand_binop (wider_mode, binoptab, xop0, xop1, 0,
  355.                    unsignedp, methods);
  356.           if (temp)
  357.         {
  358.           if (class == MODE_FLOAT)
  359.             {
  360.               if (target == 0)
  361.             target = gen_reg_rtx (mode);
  362.               convert_move (target, temp, 0);
  363.               return target;
  364.             }
  365.           else
  366.             return gen_lowpart (mode, temp);
  367.         }
  368.           else
  369.         delete_insns_since (last);
  370.         }
  371.     }
  372.     }
  373.  
  374.   return 0;
  375. }
  376.  
  377. /* Expand a binary operator which has both signed and unsigned forms.
  378.    UOPTAB is the optab for unsigned operations, and SOPTAB is for
  379.    signed operations.
  380.  
  381.    If we widen unsigned operands, we may use a signed wider operation instead
  382.    of an unsigned wider operation, since the result would be the same.  */
  383.  
  384. rtx
  385. sign_expand_binop (mode, uoptab, soptab, op0, op1, target, unsignedp, methods)
  386.     enum machine_mode mode;
  387.     optab uoptab, soptab;
  388.     rtx op0, op1, target;
  389.     int unsignedp;
  390.     enum optab_methods methods;
  391. {
  392.   register rtx temp;
  393.   optab direct_optab = unsignedp ? uoptab : soptab;
  394.   struct optab wide_soptab;
  395.  
  396.   /* Do it without widening, if possible.  */
  397.   temp = expand_binop (mode, direct_optab, op0, op1, target,
  398.                unsignedp, OPTAB_DIRECT);
  399.   if (temp || methods == OPTAB_DIRECT)
  400.     return temp;
  401.  
  402.   /* Try widening to a signed int.  Make a fake signed optab that
  403.      hides any signed insn for direct use.  */
  404.   wide_soptab = *soptab;
  405.   wide_soptab.handlers[(int) mode].insn_code = CODE_FOR_nothing;
  406.   wide_soptab.handlers[(int) mode].lib_call = 0;
  407.  
  408.   temp = expand_binop (mode, &wide_soptab, op0, op1, target,
  409.                unsignedp, OPTAB_WIDEN);
  410.  
  411.   /* For unsigned operands, try widening to an unsigned int.  */
  412.   if (temp == 0 && unsignedp)
  413.     temp = expand_binop (mode, uoptab, op0, op1, target,
  414.              unsignedp, OPTAB_WIDEN);
  415.   if (temp || methods == OPTAB_WIDEN)
  416.     return temp;
  417.  
  418.   /* Use the right width lib call if that exists.  */
  419.   temp = expand_binop (mode, direct_optab, op0, op1, target, unsignedp, OPTAB_LIB);
  420.   if (temp || methods == OPTAB_LIB)
  421.     return temp;
  422.  
  423.   /* Must widen and use a lib call, use either signed or unsigned.  */
  424.   temp = expand_binop (mode, &wide_soptab, op0, op1, target,
  425.                unsignedp, methods);
  426.   if (temp != 0)
  427.     return temp;
  428.   if (unsignedp)
  429.     return expand_binop (mode, uoptab, op0, op1, target,
  430.              unsignedp, methods);
  431.   return 0;
  432. }
  433.  
  434. /* Generate code to perform an operation specified by BINOPTAB
  435.    on operands OP0 and OP1, with two results to TARG1 and TARG2.
  436.    We assume that the order of the operands for the instruction
  437.    is TARG0, OP0, OP1, TARG1, which would fit a pattern like
  438.    [(set TARG0 (operate OP0 OP1)) (set TARG1 (operate ...))].
  439.  
  440.    Either TARG0 or TARG1 may be zero, but what that means is that
  441.    that result is not actually wanted.  We will generate it into
  442.    a dummy pseudo-reg and discard it.  They may not both be zero.
  443.  
  444.    Returns 1 if this operation can be performed; 0 if not.  */
  445.  
  446. int
  447. expand_twoval_binop (binoptab, op0, op1, targ0, targ1, unsignedp)
  448.      optab binoptab;
  449.      rtx op0, op1;
  450.      rtx targ0, targ1;
  451.      int unsignedp;
  452. {
  453.   enum machine_mode mode = GET_MODE (targ0 ? targ0 : targ1);
  454.   enum mode_class class;
  455.   enum machine_mode wider_mode;
  456.  
  457.   class = GET_MODE_CLASS (mode);
  458.  
  459.   op0 = protect_from_queue (op0, 0);
  460.   op1 = protect_from_queue (op1, 0);
  461.  
  462.   if (flag_force_mem)
  463.     {
  464.       op0 = force_not_mem (op0);
  465.       op1 = force_not_mem (op1);
  466.     }
  467.  
  468.   if (targ0)
  469.     targ0 = protect_from_queue (targ0, 1);
  470.   else
  471.     targ0 = gen_reg_rtx (mode);
  472.   if (targ1)
  473.     targ1 = protect_from_queue (targ1, 1);
  474.   else
  475.     targ1 = gen_reg_rtx (mode);
  476.  
  477.   if (binoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  478.     {
  479.       emit_insn (GEN_FCN (binoptab->handlers[(int) mode].insn_code)
  480.          (targ0, op0, op1, targ1));
  481.       return 1;
  482.     }
  483.  
  484.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  485.  
  486.   if (class == MODE_INT || class == MODE_FLOAT)
  487.     {
  488.       for (wider_mode = INC_MODE (mode);
  489.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  490.         && GET_MODE_CLASS (wider_mode) == class);
  491.        wider_mode = INC_MODE (wider_mode))
  492.     {
  493.       if (binoptab->handlers[(int) wider_mode].insn_code
  494.           != CODE_FOR_nothing)
  495.         {
  496.           expand_twoval_binop_convert (binoptab, wider_mode, op0, op1,
  497.                        targ0, targ1, unsignedp);
  498.           return 1;
  499.         }
  500.     }
  501.     }
  502.   return 0;
  503. }
  504.  
  505. int
  506. expand_twoval_binop_convert (binoptab, mode, op0, op1, targ0, targ1, unsignedp)
  507.      register optab binoptab;
  508.      register rtx op0, op1, targ0, targ1;
  509.      int unsignedp;
  510. {
  511.   register rtx t0 = gen_reg_rtx (SImode);
  512.   register rtx t1 = gen_reg_rtx (SImode);
  513.   register rtx temp;
  514.  
  515.   temp = gen_reg_rtx (SImode);
  516.   convert_move (temp, op0, unsignedp);
  517.   op0 = temp;
  518.   temp = gen_reg_rtx (SImode);
  519.   convert_move (temp, op1, unsignedp);
  520.   op1 = temp;
  521.  
  522.   expand_twoval_binop (binoptab, op0, op1, t0, t1, unsignedp);
  523.   convert_move (targ0, t0, unsignedp);
  524.   convert_move (targ1, t1, unsignedp);
  525.   return 1;
  526. }
  527.  
  528. /* Generate code to perform an operation specified by UNOPTAB
  529.    on operand OP0, with result having machine-mode MODE.
  530.  
  531.    UNSIGNEDP is for the case where we have to widen the operands
  532.    to perform the operation.  It says to use zero-extension.
  533.  
  534.    If TARGET is nonzero, the value
  535.    is generated there, if it is convenient to do so.
  536.    In all cases an rtx is returned for the locus of the value;
  537.    this may or may not be TARGET.  */
  538.  
  539. rtx
  540. expand_unop (mode, unoptab, op0, target, unsignedp)
  541.      enum machine_mode mode;
  542.      optab unoptab;
  543.      rtx op0;
  544.      rtx target;
  545.      int unsignedp;
  546. {
  547.   enum mode_class class;
  548.   enum machine_mode wider_mode;
  549.   register rtx temp;
  550.  
  551.   class = GET_MODE_CLASS (mode);
  552.  
  553.   op0 = protect_from_queue (op0, 0);
  554.  
  555.   if (flag_force_mem)
  556.     {
  557.       op0 = force_not_mem (op0);
  558.     }
  559.  
  560.   if (target)
  561.     target = protect_from_queue (target, 1);
  562.  
  563.   if (unoptab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  564.     {
  565.       int icode = (int) unoptab->handlers[(int) mode].insn_code;
  566.       enum machine_mode mode0 = insn_operand_mode[icode][1];
  567.  
  568.       if (target)
  569.     temp = target;
  570.       else
  571.     temp = gen_reg_rtx (mode);
  572.  
  573.       if (GET_MODE (op0) != VOIDmode
  574.       && GET_MODE (op0) != mode0)
  575.     op0 = convert_to_mode (mode0, op0, unsignedp);
  576.  
  577.       /* Now, if insn requires register operands, put operands into regs.  */
  578.  
  579.       if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  580.     op0 = force_reg (mode0, op0);
  581.  
  582.       if (! (*insn_operand_predicate[icode][0]) (temp, mode))
  583.     temp = gen_reg_rtx (mode);
  584.  
  585.       emit_insn (GEN_FCN (icode) (temp, op0));
  586.       return temp;
  587.     }
  588.   else if (unoptab->handlers[(int) mode].lib_call)
  589.     {
  590.       rtx insn_before, insn_last;
  591.       rtx funexp = gen_rtx (SYMBOL_REF, Pmode,
  592.                 unoptab->handlers[(int) mode].lib_call);
  593.  
  594.       /* Pass the address through a pseudoreg, if desired,
  595.      before the "beginning" of the library call (for deletion).  */
  596. #ifndef NO_FUNCTION_CSE
  597.       if (! flag_no_function_cse)
  598.     funexp = copy_to_mode_reg (Pmode, funexp);
  599. #endif
  600.  
  601.       insn_before = get_last_insn ();
  602.  
  603.       /* Cannot pass FUNEXP since  emit_library_call insists
  604.      on getting a SYMBOL_REF.  But cse will make this SYMBOL_REF
  605.      be replaced with the copy we made just above.  */
  606.       /* Pass 1 for NO_QUEUE so we don't lose any increments
  607.      if the libcall is cse'd or moved.  */
  608.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  609.                   unoptab->handlers[(int) mode].lib_call),
  610.              1, mode, 1, op0, mode);
  611.       target = hard_libcall_value (mode);
  612.       temp = copy_to_reg (target);
  613.       insn_last = get_last_insn ();
  614.       REG_NOTES (insn_last)
  615.     = gen_rtx (EXPR_LIST, REG_EQUAL,
  616.            gen_rtx (unoptab->code, mode, op0),
  617.            gen_rtx (INSN_LIST, REG_RETVAL,
  618.                 NEXT_INSN (insn_before),
  619.                 REG_NOTES (insn_last)));
  620.       REG_NOTES (NEXT_INSN (insn_before))
  621.     = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  622.            REG_NOTES (NEXT_INSN (insn_before)));
  623.       return temp;
  624.     }
  625.  
  626.   /* It can't be done in this mode.  Can we do it in a wider mode?  */
  627.  
  628.   if (class == MODE_INT || class == MODE_FLOAT)
  629.     {
  630.       for (wider_mode = INC_MODE (mode);
  631.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  632.         && GET_MODE_CLASS (wider_mode) == class);
  633.        wider_mode = INC_MODE (wider_mode))
  634.     {
  635.       if ((unoptab->handlers[(int) wider_mode].insn_code
  636.            != CODE_FOR_nothing)
  637.           || unoptab->handlers[(int) wider_mode].lib_call)
  638.         {
  639.           if (GET_MODE (op0) != VOIDmode)
  640.         {
  641.           temp = gen_reg_rtx (wider_mode);
  642.           convert_move (temp, op0, unsignedp);
  643.           op0 = temp;
  644.         }
  645.           
  646.           target = expand_unop (wider_mode, unoptab, op0, 0, unsignedp);
  647.           if (class == MODE_FLOAT)
  648.         {
  649.           if (target == 0)
  650.             target = gen_reg_rtx (mode);
  651.           convert_move (target, temp, 0);
  652.           return target;
  653.         }
  654.           else
  655.         return gen_lowpart (mode, target);
  656.         }
  657.     }
  658.     }
  659.  
  660.   return 0;
  661. }
  662.  
  663. /* Generate an instruction whose insn-code is INSN_CODE,
  664.    with two operands: an output TARGET and an input OP0.
  665.    TARGET *must* be nonzero, and the output is always stored there.
  666.    CODE is an rtx code such that (CODE OP0) is an rtx that describes
  667.    the value that is stored into TARGET.  */
  668.  
  669. void
  670. emit_unop_insn (icode, target, op0, code)
  671.      int icode;
  672.      rtx target;
  673.      rtx op0;
  674.      enum rtx_code code;
  675. {
  676.   register rtx temp;
  677.   enum machine_mode mode0 = insn_operand_mode[icode][1];
  678.   rtx insn;
  679.   rtx prev_insn;
  680.  
  681.   temp = target = protect_from_queue (target, 1);
  682.  
  683.   op0 = protect_from_queue (op0, 0);
  684.  
  685.   if (flag_force_mem)
  686.     op0 = force_not_mem (op0);
  687.  
  688.   /* Now, if insn requires register operands, put operands into regs.  */
  689.  
  690.   if (! (*insn_operand_predicate[icode][1]) (op0, mode0))
  691.     op0 = force_reg (mode0, op0);
  692.  
  693.   if (! (*insn_operand_predicate[icode][0]) (temp, GET_MODE (temp))
  694.       || (flag_force_mem && GET_CODE (temp) == MEM))
  695.     temp = gen_reg_rtx (GET_MODE (temp));
  696.  
  697.   prev_insn = get_last_insn ();
  698.   insn = emit_insn (GEN_FCN (icode) (temp, op0));
  699.  
  700.   /* If we just made a multi-insn sequence,
  701.      record in the last insn an equivalent expression for its value
  702.      and a pointer to the first insn.  This makes cse possible.  */
  703.   if (code != UNKNOWN && PREV_INSN (insn) != prev_insn)
  704.     REG_NOTES (insn)
  705.       = gen_rtx (EXPR_LIST, REG_EQUAL,
  706.          gen_rtx (code, GET_MODE (temp), op0),
  707.          REG_NOTES (insn));
  708.   
  709.   if (temp != target)
  710.     emit_move_insn (target, temp);
  711. }
  712.  
  713. /* Generate code to store zero in X.  */
  714.  
  715. void
  716. emit_clr_insn (x)
  717.      rtx x;
  718. {
  719.   emit_move_insn (x, const0_rtx);
  720. }
  721.  
  722. /* Generate code to store 1 in X
  723.    assuming it contains zero beforehand.  */
  724.  
  725. void
  726. emit_0_to_1_insn (x)
  727.      rtx x;
  728. {
  729.   emit_move_insn (x, const1_rtx);
  730. }
  731.  
  732. /* Generate code to compare X with Y
  733.    so that the condition codes are set.
  734.  
  735.    UNSIGNEDP nonzero says that X and Y are unsigned;
  736.    this matters if they need to be widened.
  737.  
  738.    If they have mode BLKmode, then SIZE specifies the size of both X and Y,
  739.    and ALIGN specifies the known shared alignment of X and Y.  */
  740.  
  741. void
  742. emit_cmp_insn (x, y, size, unsignedp, align)
  743.      rtx x, y;
  744.      rtx size;
  745.      int unsignedp;
  746.      int align;
  747. {
  748.   enum machine_mode mode = GET_MODE (x);
  749.   enum mode_class class;
  750.   enum machine_mode wider_mode;
  751.  
  752.   if (mode == VOIDmode) mode = GET_MODE (y);
  753.   /* They could both be VOIDmode if both args are immediate constants,
  754.      but we should fold that at an earlier stage.
  755.      With no special code here, this will call abort,
  756.      reminding the programmer to implement such folding.  */
  757.  
  758.   class = GET_MODE_CLASS (mode);
  759.  
  760.   if (mode != BLKmode && flag_force_mem)
  761.     {
  762.       x = force_not_mem (x);
  763.       y = force_not_mem (y);
  764.     }
  765.  
  766.   /* Handle all BLKmode compares.  */
  767.  
  768.   if (mode == BLKmode)
  769.     {
  770.       emit_queue ();
  771.       x = protect_from_queue (x, 0);
  772.       y = protect_from_queue (y, 0);
  773.  
  774.       if (size == 0)
  775.     abort ();
  776. #ifdef HAVE_cmpstrqi
  777.       if (HAVE_cmpstrqi
  778.       && GET_CODE (size) == CONST_INT
  779.       && INTVAL (size) < (1 << GET_MODE_BITSIZE (QImode)))
  780.     emit_insn (gen_cmpstrqi (x, y, size,
  781.                  gen_rtx (CONST_INT, VOIDmode, align)));
  782.       else
  783. #endif
  784. #ifdef HAVE_cmpstrhi
  785.       if (HAVE_cmpstrhi
  786.       && GET_CODE (size) == CONST_INT
  787.       && INTVAL (size) < (1 << GET_MODE_BITSIZE (HImode)))
  788.     emit_insn (gen_cmpstrhi (x, y, size,
  789.                  gen_rtx (CONST_INT, VOIDmode, align)));
  790.       else
  791. #endif
  792. #ifdef HAVE_cmpstrpsi
  793.       if (HAVE_cmpstrpsi
  794.       && GET_CODE (size) == CONST_INT
  795.       && INTVAL (size) < (1 << GET_MODE_BITSIZE (PSImode)))
  796.     emit_insn (gen_cmpstrpsi (x, y, size,
  797.                  gen_rtx (CONST_INT, VOIDmode, align)));
  798.       else
  799. #endif
  800. #ifdef HAVE_cmpstrsi
  801.       if (HAVE_cmpstrsi)
  802.     emit_insn (gen_cmpstrsi (x, y, convert_to_mode (SImode, size, 1),
  803.                  gen_rtx (CONST_INT, VOIDmode, align)));
  804.       else
  805. #endif
  806.     {
  807. #ifdef TARGET_MEM_FUNCTIONS
  808.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcmp"), 0, 
  809.                  SImode, 3,
  810.                  XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
  811.                  size, Pmode);
  812. #else
  813.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcmp"), 0,
  814.                  SImode, 3,
  815.                  XEXP (x, 0), Pmode, XEXP (y, 0), Pmode,
  816.                  size, Pmode);
  817. #endif
  818.       emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0, 0);
  819.     }
  820.       return;
  821.     }
  822.  
  823.   /* Handle some compares against zero.  */
  824.  
  825.   if (y == CONST0_RTX (mode)
  826.       && tst_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  827.     {
  828.       int icode = (int) tst_optab->handlers[(int) mode].insn_code;
  829.  
  830.       emit_queue ();
  831.       x = protect_from_queue (x, 0);
  832.       y = protect_from_queue (y, 0);
  833.  
  834.       /* Now, if insn requires register operands, put operands into regs.  */
  835.       if (! (*insn_operand_predicate[icode][0])
  836.       (x, insn_operand_mode[icode][0]))
  837.     x = force_reg (insn_operand_mode[icode][0], x);
  838.  
  839.       emit_insn (GEN_FCN (icode) (x));
  840.       return;
  841.     }
  842.  
  843.   /* Handle compares for which there is a directly suitable insn.  */
  844.  
  845.   if (cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  846.     {
  847.       int icode = (int) cmp_optab->handlers[(int) mode].insn_code;
  848.  
  849.       emit_queue ();
  850.       x = protect_from_queue (x, 0);
  851.       y = protect_from_queue (y, 0);
  852.  
  853.       /* Now, if insn requires register operands, put operands into regs.  */
  854.       if (! (*insn_operand_predicate[icode][0])
  855.       (x, insn_operand_mode[icode][0]))
  856.     x = force_reg (insn_operand_mode[icode][0], x);
  857.  
  858.       if (! (*insn_operand_predicate[icode][1])
  859.       (y, insn_operand_mode[icode][1]))
  860.     y = force_reg (insn_operand_mode[icode][1], y);
  861.  
  862.       emit_insn (GEN_FCN (icode) (x, y));
  863.       return;
  864.     }
  865.  
  866.   /* Try widening if we can find a direct insn that way.  */
  867.  
  868.   if (class == MODE_INT || class == MODE_FLOAT)
  869.     {
  870.       for (wider_mode = INC_MODE (mode);
  871.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  872.         && GET_MODE_CLASS (wider_mode) == class);
  873.        wider_mode = INC_MODE (wider_mode))
  874.     {
  875.       if (cmp_optab->handlers[(int) wider_mode].insn_code
  876.           != CODE_FOR_nothing)
  877.         {
  878.           x = convert_to_mode (wider_mode, x, unsignedp);
  879.           y = convert_to_mode (wider_mode, y, unsignedp);
  880.           emit_cmp_insn (x, y, 0, unsignedp, align);
  881.           return;
  882.         }
  883.     }
  884.     }
  885.  
  886.   /* Handle a lib call just for the mode we are using.  */
  887.  
  888.   if (cmp_optab->handlers[(int) mode].lib_call)
  889.     {
  890.       char *string = cmp_optab->handlers[(int) mode].lib_call;
  891.       /* If we want unsigned, and this mode has a distinct unsigned
  892.      comparison routine, use that.  */
  893.       if (unsignedp && ucmp_optab->handlers[(int) mode].lib_call)
  894.     string = ucmp_optab->handlers[(int) mode].lib_call;
  895.  
  896.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, string), 0,
  897.              SImode, 2, x, mode, y, mode);
  898.  
  899.       /* Integer comparison returns a result that must be compared against 1,
  900.      so that even if we do an unsigned compare afterward,
  901.      there is still a value that can represent the result "less than".  */
  902.       if (GET_MODE_CLASS (mode) == MODE_INT)
  903.     emit_cmp_insn (hard_libcall_value (SImode), const1_rtx, 0, unsignedp, 0);
  904. #if ! defined( DSP56000 )
  905.       else
  906.     emit_cmp_insn (hard_libcall_value (SImode), const0_rtx, 0, 0, 0);
  907. #endif
  908.       return;
  909.     }
  910.  
  911.   /* Try widening and then using a libcall.  */
  912.  
  913.   if (class == MODE_FLOAT)
  914.     {
  915.       for (wider_mode = INC_MODE (mode);
  916.        ((int) wider_mode < (int) MAX_MACHINE_MODE
  917.         && GET_MODE_CLASS (wider_mode) == class);
  918.        wider_mode = INC_MODE (wider_mode))
  919.     {
  920.       if ((cmp_optab->handlers[(int) wider_mode].insn_code
  921.            != CODE_FOR_nothing)
  922.           || (cmp_optab->handlers[(int) wider_mode].lib_call != 0))
  923.         {
  924.           x = convert_to_mode (wider_mode, x, unsignedp);
  925.           y = convert_to_mode (wider_mode, y, unsignedp);
  926.           emit_cmp_insn (x, y, 0, unsignedp, align);
  927.         }
  928.     }
  929.       return;
  930.     }
  931.  
  932.   abort ();
  933. }
  934.  
  935. /* These three functions generate an insn body and return it
  936.    rather than emitting the insn.
  937.  
  938.    They do not protect from queued increments,
  939.    because they may be used 1) in protect_from_queue itself
  940.    and 2) in other passes where there is no queue.  */
  941.  
  942. /* Generate and return an insn body to add Y to X.  */
  943.  
  944. rtx
  945. gen_add2_insn (x, y)
  946.      rtx x, y;
  947. {
  948.   return (GEN_FCN (add_optab->handlers[(int) GET_MODE (x)].insn_code)
  949.       (x, x, y));
  950. }
  951.  
  952. int
  953. have_add2_insn (mode)
  954.      enum machine_mode mode;
  955. {
  956.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  957. }
  958.  
  959. /* Generate and return an insn body to subtract Y from X.  */
  960.  
  961. rtx
  962. gen_sub2_insn (x, y)
  963.      rtx x, y;
  964. {
  965.   return (GEN_FCN (sub_optab->handlers[(int) GET_MODE (x)].insn_code)
  966.       (x, x, y));
  967. }
  968.  
  969. int
  970. have_sub2_insn (mode)
  971.      enum machine_mode mode;
  972. {
  973.   return add_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing;
  974. }
  975.  
  976. /* Generate the body of an instruction to copy Y into X.  */
  977.  
  978. rtx
  979. gen_move_insn (x, y)
  980.      rtx x, y;
  981. {
  982.   register enum machine_mode mode = GET_MODE (x);
  983.   if (mode == VOIDmode)
  984.     mode = GET_MODE (y);
  985.   return (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  986. }
  987.  
  988. #if 0
  989. /* Tables of patterns for extending one integer mode to another.  */
  990. enum insn_code zero_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  991. enum insn_code sign_extend_optab[MAX_MACHINE_MODE][MAX_MACHINE_MODE];
  992.  
  993. /* Generate the body of an insn to extend Y (with mode MFROM)
  994.    into X (with mode MTO).  Do zero-extension if UNSIGNEDP is nonzero.  */
  995.  
  996. rtx
  997. gen_extend_insn (x, y, mto, mfrom, unsignedp)
  998.      rtx x, y;
  999.      enum machine_mode mto, mfrom;
  1000.      int unsignedp;
  1001. {
  1002.   return (GEN_FCN ((unsignedp ? zero_extend_optab : sign_extend_optab)
  1003.            [(int)mto][(int)mfrom])
  1004.       (x, y));
  1005. }
  1006.  
  1007. static void
  1008. init_extends ()
  1009. {
  1010.   bzero (sign_extend_optab, sizeof sign_extend_optab);
  1011.   bzero (zero_extend_optab, sizeof zero_extend_optab);
  1012.   sign_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_extendhisi2;
  1013.   sign_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_extendqisi2;
  1014.   sign_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_extendqihi2;
  1015.   zero_extend_optab[(int) SImode][(int) HImode] = CODE_FOR_zero_extendhisi2;
  1016.   zero_extend_optab[(int) SImode][(int) QImode] = CODE_FOR_zero_extendqisi2;
  1017.   zero_extend_optab[(int) HImode][(int) QImode] = CODE_FOR_zero_extendqihi2;
  1018. }
  1019. #endif
  1020.  
  1021. /* can_fix_p and can_float_p say whether the target machine
  1022.    can directly convert a given fixed point type to
  1023.    a given floating point type, or vice versa.
  1024.    The returned value is the CODE_FOR_... value to use,
  1025.    or CODE_FOR_nothing if these modes cannot be directly converted.  */
  1026.  
  1027. static enum insn_code fixtab[2][2][2];
  1028. static enum insn_code fixtrunctab[2][2][2];
  1029. #if defined( DSP96000 )
  1030. static enum insn_code floattab[2][2][2];
  1031. #else
  1032. static enum insn_code floattab[2][2];
  1033. #endif
  1034.  
  1035. /* *TRUNCP_PTR is set to 1 if it is necessary to output
  1036.    an explicit FTRUNC insn before the fix insn; otherwise 0.  */
  1037.  
  1038. static enum insn_code
  1039. can_fix_p (fixmode, fltmode, unsignedp, truncp_ptr)
  1040.      enum machine_mode fltmode, fixmode;
  1041.      int unsignedp;
  1042.      int *truncp_ptr;
  1043. {
  1044.   *truncp_ptr = 0;
  1045.   if (fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp]
  1046.       != CODE_FOR_nothing)
  1047.     return fixtrunctab[fltmode != SFmode][fixmode == DImode][unsignedp];
  1048.   if (ftrunc_optab->handlers[(int) fltmode].insn_code != CODE_FOR_nothing)
  1049.     {
  1050.       *truncp_ptr = 1;
  1051.       return fixtab[fltmode != SFmode][fixmode == DImode][unsignedp];
  1052.     }
  1053.   return CODE_FOR_nothing;
  1054. }
  1055.  
  1056. static enum insn_code
  1057. #if defined( DSP96000 )
  1058. can_float_p (fltmode, fixmode, unsignedp)
  1059.      enum machine_mode fixmode, fltmode;
  1060.      int unsignedp;
  1061. {
  1062.   return floattab[fltmode != SFmode][fixmode == DImode][unsignedp];
  1063. }
  1064. #else
  1065. can_float_p (fltmode, fixmode)
  1066.      enum machine_mode fixmode, fltmode;
  1067. {
  1068.   return floattab[fltmode != SFmode][fixmode == DImode];
  1069. }
  1070. #endif
  1071.  
  1072. void
  1073. init_fixtab ()
  1074. {
  1075.   enum insn_code *p;
  1076.   for (p = fixtab[0][0];
  1077.        p < fixtab[0][0] + sizeof fixtab / sizeof (fixtab[0][0][0]); 
  1078.        p++)
  1079.     *p = CODE_FOR_nothing;
  1080.   for (p = fixtrunctab[0][0];
  1081.        p < fixtrunctab[0][0] + sizeof fixtrunctab / sizeof (fixtrunctab[0][0][0]); 
  1082.        p++)
  1083.     *p = CODE_FOR_nothing;
  1084.  
  1085. #ifdef HAVE_fixsfsi2
  1086.   if (HAVE_fixsfsi2)
  1087.     fixtab[0][0][0] = CODE_FOR_fixsfsi2;
  1088. #endif
  1089. #ifdef HAVE_fixsfdi2
  1090.   if (HAVE_fixsfdi2)
  1091.     fixtab[0][1][0] = CODE_FOR_fixsfdi2;
  1092. #endif
  1093. #ifdef HAVE_fixdfsi2
  1094.   if (HAVE_fixdfsi2)
  1095.     fixtab[1][0][0] = CODE_FOR_fixdfsi2;
  1096. #endif
  1097. #ifdef HAVE_fixdfdi2
  1098.   if (HAVE_fixdfdi2)
  1099.     fixtab[1][1][0] = CODE_FOR_fixdfdi2;
  1100. #endif
  1101.  
  1102. #ifdef HAVE_fixunssfsi2
  1103.   if (HAVE_fixunssfsi2)
  1104.     fixtab[0][0][1] = CODE_FOR_fixunssfsi2;
  1105. #endif
  1106. #ifdef HAVE_fixunssfdi2
  1107.   if (HAVE_fixunssfdi2)
  1108.     fixtab[0][1][1] = CODE_FOR_fixunssfdi2;
  1109. #endif
  1110. #ifdef HAVE_fixunsdfsi2
  1111.   if (HAVE_fixunsdfsi2)
  1112.     fixtab[1][0][1] = CODE_FOR_fixunsdfsi2;
  1113. #endif
  1114. #ifdef HAVE_fixunsdfdi2
  1115.   if (HAVE_fixunsdfdi2)
  1116.     fixtab[1][1][1] = CODE_FOR_fixunsdfdi2;
  1117. #endif
  1118.  
  1119. #ifdef HAVE_fix_truncsfsi2
  1120.   if (HAVE_fix_truncsfsi2)
  1121.     fixtrunctab[0][0][0] = CODE_FOR_fix_truncsfsi2;
  1122. #endif
  1123. #ifdef HAVE_fix_truncsfdi2
  1124.   if (HAVE_fix_truncsfdi2)
  1125.     fixtrunctab[0][1][0] = CODE_FOR_fix_truncsfdi2;
  1126. #endif
  1127. #ifdef HAVE_fix_truncdfsi2
  1128.   if (HAVE_fix_truncdfsi2)
  1129.     fixtrunctab[1][0][0] = CODE_FOR_fix_truncdfsi2;
  1130. #endif
  1131. #ifdef HAVE_fix_truncdfdi2
  1132.   if (HAVE_fix_truncdfdi2)
  1133.     fixtrunctab[1][1][0] = CODE_FOR_fix_truncdfdi2;
  1134. #endif
  1135.  
  1136. #ifdef HAVE_fixuns_truncsfsi2
  1137.   if (HAVE_fixuns_truncsfsi2)
  1138.     fixtrunctab[0][0][1] = CODE_FOR_fixuns_truncsfsi2;
  1139. #endif
  1140. #ifdef HAVE_fixuns_truncsfdi2
  1141.   if (HAVE_fixuns_truncsfdi2)
  1142.     fixtrunctab[0][1][1] = CODE_FOR_fixuns_truncsfdi2;
  1143. #endif
  1144. #ifdef HAVE_fixuns_truncdfsi2
  1145.   if (HAVE_fixuns_truncdfsi2)
  1146.     fixtrunctab[1][0][1] = CODE_FOR_fixuns_truncdfsi2;
  1147. #endif
  1148. #ifdef HAVE_fixuns_truncdfdi2
  1149.   if (HAVE_fixuns_truncdfdi2)
  1150.     fixtrunctab[1][1][1] = CODE_FOR_fixuns_truncdfdi2;
  1151. #endif
  1152.  
  1153. #ifdef FIXUNS_TRUNC_LIKE_FIX_TRUNC
  1154.   /* This flag says the same insns that convert to a signed fixnum
  1155.      also convert validly to an unsigned one.  */
  1156.   {
  1157.     int i;
  1158.     int j;
  1159.     for (i = 0; i < 2; i++)
  1160.       for (j = 0; j < 2; j++)
  1161.     fixtrunctab[i][j][1] = fixtrunctab[i][j][0];
  1162.   }
  1163. #endif
  1164. }
  1165.  
  1166. void
  1167. init_floattab ()
  1168. {
  1169. #if defined( DSP96000 )
  1170.   enum insn_code p = CODE_FOR_nothing, *q = & floattab[0][0][0];
  1171.     
  1172.   for ( ; q <= & floattab[1][1][1]; q++ )
  1173.   {
  1174.       *q = p;
  1175.   }
  1176.  
  1177. #ifdef HAVE_floatsisf2
  1178.   if (HAVE_floatsisf2)
  1179.     floattab[0][0][0] = CODE_FOR_floatsisf2;
  1180. #endif
  1181. #ifdef HAVE_floatdisf2
  1182.   if (HAVE_floatdisf2)
  1183.     floattab[0][1][0] = CODE_FOR_floatdisf2;
  1184. #endif
  1185. #ifdef HAVE_floatsidf2
  1186.   if (HAVE_floatsidf2)
  1187.     floattab[1][0][0] = CODE_FOR_floatsidf2;
  1188. #endif
  1189. #ifdef HAVE_floatdidf2
  1190.   if (HAVE_floatdidf2)
  1191.     floattab[1][1][0] = CODE_FOR_floatdidf2;
  1192. #endif
  1193. #ifdef HAVE_floatsisf2
  1194.   if (HAVE_floatsisf2)
  1195.     floattab[0][0][1] = CODE_FOR_floatunssisf2;
  1196. #endif
  1197. #ifdef HAVE_floatdisf2
  1198.   if (HAVE_floatdisf2)
  1199.     floattab[0][1][1] = CODE_FOR_floatunsdisf2;
  1200. #endif
  1201. #ifdef HAVE_floatsidf2
  1202.   if (HAVE_floatsidf2)
  1203.     floattab[1][0][1] = CODE_FOR_floatunssidf2;
  1204. #endif
  1205. #ifdef HAVE_floatdidf2
  1206.   if (HAVE_floatdidf2)
  1207.     floattab[1][1][1] = CODE_FOR_floatunsdidf2;
  1208. #endif
  1209. #else
  1210.   enum insn_code *p;
  1211.   for (p = floattab[0];
  1212.        p < floattab[0] + sizeof floattab / sizeof (floattab[0][0]); 
  1213.        p++)
  1214.     *p = CODE_FOR_nothing;
  1215.  
  1216. #ifdef HAVE_floatsisf2
  1217.   if (HAVE_floatsisf2)
  1218.     floattab[0][0] = CODE_FOR_floatsisf2;
  1219. #endif
  1220. #ifdef HAVE_floatdisf2
  1221.   if (HAVE_floatdisf2)
  1222.     floattab[0][1] = CODE_FOR_floatdisf2;
  1223. #endif
  1224. #ifdef HAVE_floatsidf2
  1225.   if (HAVE_floatsidf2)
  1226.     floattab[1][0] = CODE_FOR_floatsidf2;
  1227. #endif
  1228. #ifdef HAVE_floatdidf2
  1229.   if (HAVE_floatdidf2)
  1230.     floattab[1][1] = CODE_FOR_floatdidf2;
  1231. #endif
  1232. #endif
  1233. }
  1234.  
  1235. /* Generate code to convert FROM to floating point
  1236.    and store in TO.  FROM must be fixed point.
  1237.    UNSIGNEDP nonzero means regard FROM as unsigned.
  1238.    Normally this is done by correcting the final value
  1239.    if it is negative.  */
  1240.  
  1241. void
  1242. expand_float (real_to, from, unsignedp)
  1243.      rtx real_to, from;
  1244.      int unsignedp;
  1245. {
  1246.   enum insn_code icode;
  1247.   register rtx to;
  1248.  
  1249.   /* Constants should get converted in `fold'.
  1250.      We lose here since we don't know the mode.  */
  1251.   if (GET_MODE (from) == VOIDmode)
  1252.     abort ();
  1253.  
  1254.   to = real_to = protect_from_queue (real_to, 1);
  1255.   from = protect_from_queue (from, 0);
  1256.  
  1257.   if (flag_force_mem)
  1258.     {
  1259.       from = force_not_mem (from);
  1260.     }
  1261.  
  1262.   /* If we are about to do some arithmetic to correct for an
  1263.      unsigned operand, do it in a register.  */
  1264.  
  1265. #if ! defined( DSP96000 )
  1266.   if (unsignedp && GET_CODE (to) != REG)
  1267.     to = gen_reg_rtx (GET_MODE (to));
  1268. #else
  1269.   /* 96k has floatu.[sx] - no assemetry between signed/unsigned. */
  1270. #endif
  1271.  
  1272.   /* Now do the basic conversion.  Do it in the specified modes if possible;
  1273.      otherwise convert either input, output or both with wider mode;
  1274.      otherwise use a library call.  */
  1275.  
  1276. #if defined( DSP96000 )
  1277.   if ((icode = can_float_p (GET_MODE (to), GET_MODE (from), unsignedp))
  1278.       != CODE_FOR_nothing)
  1279. #else
  1280.   if ((icode = can_float_p (GET_MODE (to), GET_MODE (from)))
  1281.       != CODE_FOR_nothing)
  1282. #endif
  1283.     {
  1284. #if defined( DSP96000 )
  1285.       if ( unsignedp )
  1286.         {
  1287.       emit_unop_insn (icode, to, from, UNSIGNED_FLOAT);
  1288.         }
  1289.       else
  1290.         {
  1291.       emit_unop_insn (icode, to, from, FLOAT);
  1292.         }
  1293. #else
  1294.       emit_unop_insn (icode, to, from, FLOAT);
  1295. #endif
  1296.     }
  1297. #if defined( DSP96000 )
  1298.   else if (GET_MODE (to) == SFmode
  1299.        && ((icode = can_float_p (DFmode, GET_MODE (from), unsignedp))
  1300.            != CODE_FOR_nothing))
  1301. #else
  1302.   else if (GET_MODE (to) == SFmode
  1303.        && ((icode = can_float_p (DFmode, GET_MODE (from)))
  1304.            != CODE_FOR_nothing))
  1305. #endif
  1306.     {
  1307.       to = gen_reg_rtx (DFmode);
  1308.       emit_unop_insn (icode, to, from, FLOAT);
  1309.     }
  1310.   /* If we can't float a SI, maybe we can float a DI.
  1311.      If so, convert to DI and then float.  */
  1312.   else if (GET_MODE (from) != DImode
  1313. #if defined( DSP96000 )
  1314.        && (can_float_p (GET_MODE (to), DImode, unsignedp) !=
  1315.            CODE_FOR_nothing
  1316.            || can_float_p (DFmode, DImode, unsignedp) != CODE_FOR_nothing))
  1317. #else
  1318.        && (can_float_p (GET_MODE (to), DImode) != CODE_FOR_nothing
  1319.            || can_float_p (DFmode, DImode) != CODE_FOR_nothing))
  1320. #endif
  1321.     {
  1322.       register rtx tem = gen_reg_rtx (DImode);
  1323.       convert_move (tem, from, unsignedp);
  1324.       from = tem;
  1325.       /* If we extend FROM then we don't need to correct
  1326.      the final value for unsignedness.  */
  1327.       unsignedp = 0;
  1328.  
  1329. #if defined( DSP96000 )
  1330.       if ((icode = can_float_p (GET_MODE (to), GET_MODE (from), unsignedp))
  1331.       != CODE_FOR_nothing)
  1332. #else
  1333.       if ((icode = can_float_p (GET_MODE (to), GET_MODE (from)))
  1334.       != CODE_FOR_nothing)
  1335. #endif
  1336.     {
  1337.       emit_unop_insn (icode, to, from, FLOAT);
  1338.     }
  1339. #if defined( DSP96000 )
  1340.       else if ((icode = can_float_p (DFmode, DImode, unsignedp))
  1341.             != CODE_FOR_nothing)
  1342. #else
  1343.       else if ((icode = can_float_p (DFmode, DImode))
  1344.             != CODE_FOR_nothing)
  1345. #endif
  1346.     {
  1347.       to = gen_reg_rtx (DFmode);
  1348.       emit_unop_insn (icode, to, from, FLOAT);
  1349.     }
  1350.     }
  1351.   /* No hardware instruction available; call a library
  1352.      to convert from SImode or DImode into DFmode.  */
  1353.   else
  1354.     {
  1355.       if (GET_MODE_SIZE (GET_MODE (from)) < GET_MODE_SIZE (SImode))
  1356.     {
  1357.       from = convert_to_mode (SImode, from, unsignedp);
  1358.       unsignedp = 0;
  1359.     }
  1360.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1361.                   (GET_MODE (from) == SImode ? "__floatsidf"
  1362.                    : "__floatdidf")),
  1363.              0, DFmode, 1, from, GET_MODE (from));
  1364.       to = copy_to_reg (hard_libcall_value (DFmode));
  1365.     }
  1366.  
  1367.   /* If FROM was unsigned but we treated it as signed,
  1368.      then in the case where it is negative (and therefore TO is negative),
  1369.      correct its value by 2**bitwidth.  */
  1370.  
  1371. #if ! defined( DSP96000 )
  1372.   if (unsignedp)
  1373.     {
  1374.       rtx label = gen_label_rtx ();
  1375.       rtx temp;
  1376.       REAL_VALUE_TYPE offset;
  1377.  
  1378.       do_pending_stack_adjust ();
  1379.       emit_cmp_insn (to, GET_MODE (to) == DFmode ? dconst0_rtx : fconst0_rtx,
  1380.              0, 0, 0);
  1381.       emit_jump_insn (gen_bge (label));
  1382.       offset = REAL_VALUE_LDEXP (1.0, GET_MODE_BITSIZE (GET_MODE (from)));
  1383.       temp = expand_binop (GET_MODE (to), add_optab, to,
  1384.                immed_real_const_1 (offset, GET_MODE (to)),
  1385.                to, 0, OPTAB_LIB_WIDEN);
  1386.       if (temp != to)
  1387.     emit_move_insn (to, temp);
  1388.       do_pending_stack_adjust ();
  1389.       emit_label (label);
  1390.     }
  1391. #endif
  1392.  
  1393.   /* Copy result to requested destination
  1394.      if we have been computing in a temp location.  */
  1395.  
  1396.   if (to != real_to)
  1397.     {
  1398.       if (GET_MODE (real_to) == GET_MODE (to))
  1399.     emit_move_insn (real_to, to);
  1400.       else
  1401.     convert_move (real_to, to, 0);
  1402.     }
  1403. }
  1404.  
  1405. /* expand_fix: generate code to convert FROM to fixed point
  1406.    and store in TO.  FROM must be floating point.  */
  1407.  
  1408. static rtx
  1409. ftruncify (x)
  1410.      rtx x;
  1411. {
  1412.   rtx temp = gen_reg_rtx (GET_MODE (x));
  1413.   return expand_unop (GET_MODE (x), ftrunc_optab, x, temp, 0);
  1414. }
  1415.  
  1416. void
  1417. expand_fix (to, from, unsignedp)
  1418.      register rtx to, from;
  1419.      int unsignedp;
  1420. {
  1421.   enum insn_code icode;
  1422.   register rtx target;
  1423.   int must_trunc = 0;
  1424.  
  1425.   while (1)
  1426.     {
  1427.       icode = can_fix_p (GET_MODE (to), GET_MODE (from), unsignedp, &must_trunc);
  1428.       if (icode != CODE_FOR_nothing)
  1429.     {
  1430.       if (must_trunc)
  1431.         from = ftruncify (from);
  1432.  
  1433.       emit_unop_insn (icode, to, from, FIX);
  1434.       return;
  1435.     }
  1436.  
  1437. #if 0  /* Turned off.  It fails because the positive numbers
  1438.       that become temporarily negative are rounded up instead of down.  */
  1439.  
  1440.       /* If no insns for unsigned conversion,
  1441.      we can go via a signed number.
  1442.      But make sure we won't overflow in the compiler.  */
  1443.       if (unsignedp && GET_MODE_BITSIZE (GET_MODE (to)) <= HOST_BITS_PER_INT
  1444.       /* Make sure we won't lose significant bits doing this.  */
  1445.       && GET_MODE_BITSIZE (GET_MODE (from)) > GET_MODE_BITSIZE (GET_MODE (to)))
  1446.     {
  1447.       icode = can_fix_p (GET_MODE (to), GET_MODE (from),
  1448.                  0, &must_trunc);
  1449.  
  1450.       if (icode != CODE_FOR_nothing)
  1451.         {
  1452.           REAL_VALUE_TYPE offset;
  1453.           rtx temp, temp1;
  1454.           int bitsize = GET_MODE_BITSIZE (GET_MODE (to));
  1455.  
  1456.           if (must_trunc)
  1457.         from = ftruncify (from);
  1458.  
  1459.           /* Subtract 2**(N-1), convert to signed number,
  1460.          then add 2**(N-1).  */
  1461.           offset = REAL_VALUE_LDEXP (1.0, bitsize - 1);
  1462.           temp = expand_binop (GET_MODE (from), sub_optab, from,
  1463.                    immed_real_const_1 (offset, GET_MODE (from)),
  1464.                    0, 0, OPTAB_LIB_WIDEN);
  1465.  
  1466.           temp1 = gen_reg_rtx (GET_MODE (to));
  1467.           emit_unop_insn (icode, temp1, temp, FIX);
  1468.           temp = expand_binop (GET_MODE (to), add_optab, temp1,
  1469.                    gen_rtx (CONST_INT, VOIDmode,
  1470.                         1 << (bitsize - 1)),
  1471.                    to, 1, OPTAB_LIB_WIDEN);
  1472.           if (temp != to)
  1473.         emit_move_insn (to, temp);
  1474.           return;
  1475.         }
  1476.     }
  1477. #endif
  1478.       icode = can_fix_p (DImode, GET_MODE (from), unsignedp, &must_trunc);
  1479.  
  1480.       if (GET_MODE (to) != DImode && icode != CODE_FOR_nothing)
  1481.     {
  1482.       register rtx temp = gen_reg_rtx (DImode);
  1483.  
  1484.       if (must_trunc)
  1485.         from = ftruncify (from);
  1486.       emit_unop_insn (icode, temp, from, FIX);
  1487.       convert_move (to, temp, unsignedp);
  1488.       return;
  1489.     }
  1490.  
  1491.       /* If FROM is not DFmode, convert to DFmode and try again from there.  */
  1492.       if (GET_MODE (from) == DFmode)
  1493.     break;
  1494.  
  1495.       from = convert_to_mode (DFmode, from, 0);
  1496.     }
  1497.  
  1498.   /* We can't do it with an insn, so use a library call.
  1499.      The mode of FROM is known to be DFmode.  */
  1500.  
  1501.   to = protect_from_queue (to, 1);
  1502.   from = protect_from_queue (from, 0);
  1503.  
  1504.   if (flag_force_mem)
  1505.     from = force_not_mem (from);
  1506.  
  1507.   if (GET_MODE (to) != DImode)
  1508.     {
  1509.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1510.                   unsignedp ? "__fixunsdfsi"
  1511.                   : "__fixdfsi"),
  1512.              0, SImode, 1, from, DFmode);
  1513.       target = hard_libcall_value (SImode);
  1514.     }
  1515.   else
  1516.     {
  1517.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode,
  1518.                   unsignedp ? "__fixunsdfdi"
  1519.                   : "__fixdfdi"),
  1520.              0, DImode, 1, from, DFmode);
  1521.       target = hard_libcall_value (DImode);
  1522.     }
  1523.  
  1524.   if (GET_MODE (to) == GET_MODE (target))
  1525.     emit_move_insn (to, target);
  1526.   else
  1527.     convert_move (to, target, 0);
  1528. }
  1529.  
  1530. static optab
  1531. init_optab (code)
  1532.      enum rtx_code code;
  1533. {
  1534.   int i;
  1535.   optab op = (optab) malloc (sizeof (struct optab));
  1536.   op->code = code;
  1537.   for (i = 0; i < NUM_MACHINE_MODES; i++)
  1538.     {
  1539.       op->handlers[i].insn_code = CODE_FOR_nothing;
  1540.       op->handlers[i].lib_call = 0;
  1541.     }
  1542.   return op;
  1543. }
  1544.  
  1545. /* Call this once to initialize the contents of the optabs
  1546.    appropriately for the current target machine.  */
  1547.  
  1548. void
  1549. init_optabs ()
  1550. {
  1551.   init_fixtab ();
  1552.   init_floattab ();
  1553.   init_comparisons ();
  1554. /*  init_extends (); */
  1555.  
  1556.   add_optab = init_optab (PLUS);
  1557.   sub_optab = init_optab (MINUS);
  1558.   smul_optab = init_optab (MULT);
  1559.   umul_optab = init_optab (UMULT);
  1560.   smul_widen_optab = init_optab (MULT);
  1561.   umul_widen_optab = init_optab (UMULT);
  1562.   sdiv_optab = init_optab (DIV);
  1563.   sdivmod_optab = init_optab (UNKNOWN);
  1564.   udiv_optab = init_optab (UDIV);
  1565.   udivmod_optab = init_optab (UNKNOWN);
  1566.   smod_optab = init_optab (MOD);
  1567.   umod_optab = init_optab (UMOD);
  1568.   flodiv_optab = init_optab (DIV);
  1569.   ftrunc_optab = init_optab (UNKNOWN);
  1570.   and_optab = init_optab (AND);
  1571.   andcb_optab = init_optab (UNKNOWN);
  1572.   ior_optab = init_optab (IOR);
  1573.   xor_optab = init_optab (XOR);
  1574.   ashl_optab = init_optab (ASHIFT);
  1575.   ashr_optab = init_optab (ASHIFTRT);
  1576.   lshl_optab = init_optab (LSHIFT);
  1577.   lshr_optab = init_optab (LSHIFTRT);
  1578.   rotl_optab = init_optab (ROTATE);
  1579.   rotr_optab = init_optab (ROTATERT);
  1580.   mov_optab = init_optab (UNKNOWN);
  1581.   movstrict_optab = init_optab (UNKNOWN);
  1582.   cmp_optab = init_optab (UNKNOWN);
  1583.   ucmp_optab = init_optab (UNKNOWN);
  1584.   tst_optab = init_optab (UNKNOWN);
  1585.   neg_optab = init_optab (NEG);
  1586.   abs_optab = init_optab (ABS);
  1587.   one_cmpl_optab = init_optab (NOT);
  1588.   ffs_optab = init_optab (FFS);
  1589.  
  1590. #ifdef HAVE_addqi3
  1591.   if (HAVE_addqi3)
  1592.     add_optab->handlers[(int) QImode].insn_code = CODE_FOR_addqi3;
  1593. #endif
  1594. #ifdef HAVE_addhi3
  1595.   if (HAVE_addhi3)
  1596.     add_optab->handlers[(int) HImode].insn_code = CODE_FOR_addhi3;
  1597. #endif
  1598. #ifdef HAVE_addpsi3
  1599.   if (HAVE_addpsi3)
  1600.     add_optab->handlers[(int) PSImode].insn_code = CODE_FOR_addpsi3;
  1601. #endif
  1602. #ifdef HAVE_addsi3
  1603.   if (HAVE_addsi3)
  1604.     add_optab->handlers[(int) SImode].insn_code = CODE_FOR_addsi3;
  1605. #endif
  1606. #ifdef HAVE_adddi3
  1607.   if (HAVE_adddi3)
  1608.     add_optab->handlers[(int) DImode].insn_code = CODE_FOR_adddi3;
  1609. #endif
  1610. #ifdef HAVE_addsf3
  1611.   if (HAVE_addsf3)
  1612.     add_optab->handlers[(int) SFmode].insn_code = CODE_FOR_addsf3;
  1613. #endif
  1614. #ifdef HAVE_adddf3
  1615.   if (HAVE_adddf3)
  1616.     add_optab->handlers[(int) DFmode].insn_code = CODE_FOR_adddf3;
  1617. #endif
  1618.   add_optab->handlers[(int) DImode].lib_call = "__adddi3";
  1619.   add_optab->handlers[(int) SFmode].lib_call = "__addsf3";
  1620.   add_optab->handlers[(int) DFmode].lib_call = "__adddf3";
  1621.  
  1622. #ifdef HAVE_subqi3
  1623.   if (HAVE_subqi3)
  1624.     sub_optab->handlers[(int) QImode].insn_code = CODE_FOR_subqi3;
  1625. #endif
  1626. #ifdef HAVE_subhi3
  1627.   if (HAVE_subhi3)
  1628.     sub_optab->handlers[(int) HImode].insn_code = CODE_FOR_subhi3;
  1629. #endif
  1630. #ifdef HAVE_subpsi3
  1631.   if (HAVE_subpsi3)
  1632.     sub_optab->handlers[(int) PSImode].insn_code = CODE_FOR_subpsi3;
  1633. #endif
  1634. #ifdef HAVE_subsi3
  1635.   if (HAVE_subsi3)
  1636.     sub_optab->handlers[(int) SImode].insn_code = CODE_FOR_subsi3;
  1637. #endif
  1638. #ifdef HAVE_subdi3
  1639.   if (HAVE_subdi3)
  1640.     sub_optab->handlers[(int) DImode].insn_code = CODE_FOR_subdi3;
  1641. #endif
  1642. #ifdef HAVE_subsf3
  1643.   if (HAVE_subsf3)
  1644.     sub_optab->handlers[(int) SFmode].insn_code = CODE_FOR_subsf3;
  1645. #endif
  1646. #ifdef HAVE_subdf3
  1647.   if (HAVE_subdf3)
  1648.     sub_optab->handlers[(int) DFmode].insn_code = CODE_FOR_subdf3;
  1649. #endif
  1650.   sub_optab->handlers[(int) DImode].lib_call = "__subdi3";
  1651.   sub_optab->handlers[(int) SFmode].lib_call = "__subsf3";
  1652.   sub_optab->handlers[(int) DFmode].lib_call = "__subdf3";
  1653.  
  1654. #ifdef HAVE_mulqi3
  1655.   if (HAVE_mulqi3)
  1656.     smul_optab->handlers[(int) QImode].insn_code = CODE_FOR_mulqi3;
  1657. #endif
  1658. #ifdef HAVE_mulhi3
  1659.   if (HAVE_mulhi3)
  1660.     smul_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulhi3;
  1661. #endif
  1662. #ifdef HAVE_mulpsi3
  1663.   if (HAVE_mulpsi3)
  1664.     smul_optab->handlers[(int) PSImode].insn_code = CODE_FOR_mulpsi3;
  1665. #endif
  1666. #ifdef HAVE_mulsi3
  1667.   if (HAVE_mulsi3)
  1668.     smul_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulsi3;
  1669. #endif
  1670. #ifdef HAVE_muldi3
  1671.   if (HAVE_muldi3)
  1672.     smul_optab->handlers[(int) DImode].insn_code = CODE_FOR_muldi3;
  1673. #endif
  1674. #ifdef HAVE_mulsf3
  1675.   if (HAVE_mulsf3)
  1676.     smul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_mulsf3;
  1677. #endif
  1678. #ifdef HAVE_muldf3
  1679.   if (HAVE_muldf3)
  1680.     smul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_muldf3;
  1681. #endif
  1682.  
  1683. #ifdef MULSI3_LIBCALL
  1684.   smul_optab->handlers[(int) SImode].lib_call = MULSI3_LIBCALL;
  1685. #else
  1686.   smul_optab->handlers[(int) SImode].lib_call = "__mulsi3";
  1687. #endif
  1688.   smul_optab->handlers[(int) DImode].lib_call = "__muldi3";
  1689.   smul_optab->handlers[(int) SFmode].lib_call = "__mulsf3";
  1690.   smul_optab->handlers[(int) DFmode].lib_call = "__muldf3";
  1691.  
  1692. #ifdef HAVE_mulqihi3
  1693.   if (HAVE_mulqihi3)
  1694.     smul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_mulqihi3;
  1695. #endif
  1696. #ifdef HAVE_mulhisi3
  1697.   if (HAVE_mulhisi3)
  1698.     smul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_mulhisi3;
  1699. #endif
  1700. #ifdef HAVE_mulsidi3
  1701.   if (HAVE_mulsidi3)
  1702.     smul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_mulsidi3;
  1703. #endif
  1704.  
  1705. #ifdef HAVE_umulqi3
  1706.   if (HAVE_umulqi3)
  1707.     umul_optab->handlers[(int) QImode].insn_code = CODE_FOR_umulqi3;
  1708. #endif
  1709. #ifdef HAVE_umulhi3
  1710.   if (HAVE_umulhi3)
  1711.     umul_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulhi3;
  1712. #endif
  1713. #ifdef HAVE_umulpsi3
  1714.   if (HAVE_umulpsi3)
  1715.     umul_optab->handlers[(int) PSImode].insn_code = CODE_FOR_umulpsi3;
  1716. #endif
  1717. #ifdef HAVE_umulsi3
  1718.   if (HAVE_umulsi3)
  1719.     umul_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulsi3;
  1720. #endif
  1721. #ifdef HAVE_umuldi3
  1722.   if (HAVE_umuldi3)
  1723.     umul_optab->handlers[(int) DImode].insn_code = CODE_FOR_umuldi3;
  1724. #endif
  1725. #ifdef HAVE_umulsf3
  1726.   if (HAVE_umulsf3)
  1727.     umul_optab->handlers[(int) SFmode].insn_code = CODE_FOR_umulsf3;
  1728. #endif
  1729. #ifdef HAVE_umuldf3
  1730.   if (HAVE_umuldf3)
  1731.     umul_optab->handlers[(int) DFmode].insn_code = CODE_FOR_umuldf3;
  1732. #endif
  1733.  
  1734. #ifdef UMULSI3_LIBCALL
  1735.   umul_optab->handlers[(int) SImode].lib_call = UMULSI3_LIBCALL;
  1736. #else
  1737.   umul_optab->handlers[(int) SImode].lib_call = "__umulsi3";
  1738. #endif
  1739.   umul_optab->handlers[(int) DImode].lib_call = "__umuldi3";
  1740.   umul_optab->handlers[(int) SFmode].lib_call = "__umulsf3";
  1741.   umul_optab->handlers[(int) DFmode].lib_call = "__umuldf3";
  1742.  
  1743. #ifdef HAVE_umulqihi3
  1744.   if (HAVE_umulqihi3)
  1745.     umul_widen_optab->handlers[(int) HImode].insn_code = CODE_FOR_umulqihi3;
  1746. #endif
  1747. #ifdef HAVE_umulhisi3
  1748.   if (HAVE_umulhisi3)
  1749.     umul_widen_optab->handlers[(int) SImode].insn_code = CODE_FOR_umulhisi3;
  1750. #endif
  1751. #ifdef HAVE_umulsidi3
  1752.   if (HAVE_umulsidi3)
  1753.     umul_widen_optab->handlers[(int) DImode].insn_code = CODE_FOR_umulsidi3;
  1754. #endif
  1755.  
  1756. #ifdef HAVE_divqi3
  1757.   if (HAVE_divqi3)
  1758.     sdiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_divqi3;
  1759. #endif
  1760. #ifdef HAVE_divhi3
  1761.   if (HAVE_divhi3)
  1762.     sdiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_divhi3;
  1763. #endif
  1764. #ifdef HAVE_divpsi3
  1765.   if (HAVE_divpsi3)
  1766.     sdiv_optab->handlers[(int) PSImode].insn_code = CODE_FOR_divpsi3;
  1767. #endif
  1768. #ifdef HAVE_divsi3
  1769.   if (HAVE_divsi3)
  1770.     sdiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_divsi3;
  1771. #endif
  1772. #ifdef HAVE_divdi3
  1773.   if (HAVE_divdi3)
  1774.     sdiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_divdi3;
  1775. #endif
  1776.  
  1777. #ifdef DIVSI3_LIBCALL
  1778.   sdiv_optab->handlers[(int) SImode].lib_call = DIVSI3_LIBCALL;
  1779. #else
  1780.   sdiv_optab->handlers[(int) SImode].lib_call = "__divsi3";
  1781. #endif
  1782.   sdiv_optab->handlers[(int) DImode].lib_call = "__divdi3";
  1783.  
  1784. #ifdef HAVE_udivqi3
  1785.   if (HAVE_udivqi3)
  1786.     udiv_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivqi3;
  1787. #endif
  1788. #ifdef HAVE_udivhi3
  1789.   if (HAVE_udivhi3)
  1790.     udiv_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivhi3;
  1791. #endif
  1792. #ifdef HAVE_udivpsi3
  1793.   if (HAVE_udivpsi3)
  1794.     udiv_optab->handlers[(int) PSImode].insn_code = CODE_FOR_udivpsi3;
  1795. #endif
  1796. #ifdef HAVE_udivsi3
  1797.   if (HAVE_udivsi3)
  1798.     udiv_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivsi3;
  1799. #endif
  1800. #ifdef HAVE_udivdi3
  1801.   if (HAVE_udivdi3)
  1802.     udiv_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivdi3;
  1803. #endif
  1804.  
  1805. #ifdef UDIVSI3_LIBCALL
  1806.   udiv_optab->handlers[(int) SImode].lib_call = UDIVSI3_LIBCALL;
  1807. #else
  1808.   udiv_optab->handlers[(int) SImode].lib_call = "__udivsi3";
  1809. #endif
  1810.   udiv_optab->handlers[(int) DImode].lib_call = "__udivdi3";
  1811.  
  1812. #ifdef HAVE_divmodqi4
  1813.   if (HAVE_divmodqi4)
  1814.     sdivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_divmodqi4;
  1815. #endif
  1816. #ifdef HAVE_divmodhi4
  1817.   if (HAVE_divmodhi4)
  1818.     sdivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_divmodhi4;
  1819. #endif
  1820. #ifdef HAVE_divmodpsi4
  1821.   if (HAVE_divmodpsi4)
  1822.     sdivmod_optab->handlers[(int) PSImode].insn_code = CODE_FOR_divmodpsi4;
  1823. #endif
  1824. #ifdef HAVE_divmodsi4
  1825.   if (HAVE_divmodsi4)
  1826.     sdivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_divmodsi4;
  1827. #endif
  1828. #ifdef HAVE_divmoddi4
  1829.   if (HAVE_divmoddi4)
  1830.     sdivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_divmoddi4;
  1831. #endif
  1832.  
  1833. #ifdef HAVE_udivmodqi4
  1834.   if (HAVE_udivmodqi4)
  1835.     udivmod_optab->handlers[(int) QImode].insn_code = CODE_FOR_udivmodqi4;
  1836. #endif
  1837. #ifdef HAVE_udivmodhi4
  1838.   if (HAVE_udivmodhi4)
  1839.     udivmod_optab->handlers[(int) HImode].insn_code = CODE_FOR_udivmodhi4;
  1840. #endif
  1841. #ifdef HAVE_udivmodpsi4
  1842.   if (HAVE_udivmodpsi4)
  1843.     udivmod_optab->handlers[(int) PSImode].insn_code = CODE_FOR_udivmodpsi4;
  1844. #endif
  1845. #ifdef HAVE_udivmodsi4
  1846.   if (HAVE_udivmodsi4)
  1847.     udivmod_optab->handlers[(int) SImode].insn_code = CODE_FOR_udivmodsi4;
  1848. #endif
  1849. #ifdef HAVE_udivmoddi4
  1850.   if (HAVE_udivmoddi4)
  1851.     udivmod_optab->handlers[(int) DImode].insn_code = CODE_FOR_udivmoddi4;
  1852. #endif
  1853.  
  1854. #ifdef HAVE_modqi3
  1855.   if (HAVE_modqi3)
  1856.     smod_optab->handlers[(int) QImode].insn_code = CODE_FOR_modqi3;
  1857. #endif
  1858. #ifdef HAVE_modhi3
  1859.   if (HAVE_modhi3)
  1860.     smod_optab->handlers[(int) HImode].insn_code = CODE_FOR_modhi3;
  1861. #endif
  1862. #ifdef HAVE_modpsi3
  1863.   if (HAVE_modpsi3)
  1864.     smod_optab->handlers[(int) PSImode].insn_code = CODE_FOR_modpsi3;
  1865. #endif
  1866. #ifdef HAVE_modsi3
  1867.   if (HAVE_modsi3)
  1868.     smod_optab->handlers[(int) SImode].insn_code = CODE_FOR_modsi3;
  1869. #endif
  1870. #ifdef HAVE_moddi3
  1871.   if (HAVE_moddi3)
  1872.     smod_optab->handlers[(int) DImode].insn_code = CODE_FOR_moddi3;
  1873. #endif
  1874.  
  1875. #ifdef MODSI3_LIBCALL
  1876.   smod_optab->handlers[(int) SImode].lib_call = MODSI3_LIBCALL;
  1877. #else
  1878.   smod_optab->handlers[(int) SImode].lib_call = "__modsi3";
  1879. #endif
  1880.   smod_optab->handlers[(int) DImode].lib_call = "__moddi3";
  1881.  
  1882. #ifdef HAVE_umodqi3
  1883.   if (HAVE_umodqi3)
  1884.     umod_optab->handlers[(int) QImode].insn_code = CODE_FOR_umodqi3;
  1885. #endif
  1886. #ifdef HAVE_umodhi3
  1887.   if (HAVE_umodhi3)
  1888.     umod_optab->handlers[(int) HImode].insn_code = CODE_FOR_umodhi3;
  1889. #endif
  1890. #ifdef HAVE_umodpsi3
  1891.   if (HAVE_umodpsi3)
  1892.     umod_optab->handlers[(int) PSImode].insn_code = CODE_FOR_umodpsi3;
  1893. #endif
  1894. #ifdef HAVE_umodsi3
  1895.   if (HAVE_umodsi3)
  1896.     umod_optab->handlers[(int) SImode].insn_code = CODE_FOR_umodsi3;
  1897. #endif
  1898. #ifdef HAVE_umoddi3
  1899.   if (HAVE_umoddi3)
  1900.     umod_optab->handlers[(int) DImode].insn_code = CODE_FOR_umoddi3;
  1901. #endif
  1902.  
  1903. #ifdef UMODSI3_LIBCALL
  1904.   umod_optab->handlers[(int) SImode].lib_call = UMODSI3_LIBCALL;
  1905. #else
  1906.   umod_optab->handlers[(int) SImode].lib_call = "__umodsi3";
  1907. #endif
  1908.   umod_optab->handlers[(int) DImode].lib_call = "__umoddi3";
  1909.  
  1910. #ifdef HAVE_divsf3
  1911.   if (HAVE_divsf3)
  1912.     flodiv_optab->handlers[(int) SFmode].insn_code = CODE_FOR_divsf3;
  1913. #endif
  1914. #ifdef HAVE_divdf3
  1915.   if (HAVE_divdf3)
  1916.     flodiv_optab->handlers[(int) DFmode].insn_code = CODE_FOR_divdf3;
  1917. #endif
  1918.   flodiv_optab->handlers[(int) SFmode].lib_call = "__divsf3";
  1919.   flodiv_optab->handlers[(int) DFmode].lib_call = "__divdf3";
  1920.  
  1921. #ifdef HAVE_ftruncsf2
  1922.   if (HAVE_ftruncsf2)
  1923.     ftrunc_optab->handlers[(int) SFmode].insn_code = CODE_FOR_ftruncsf2;
  1924. #endif
  1925. #ifdef HAVE_ftruncdf2
  1926.   if (HAVE_ftruncdf2)
  1927.     ftrunc_optab->handlers[(int) DFmode].insn_code = CODE_FOR_ftruncdf2;
  1928. #endif
  1929.  
  1930. #ifdef HAVE_andqi3
  1931.   if (HAVE_andqi3)
  1932.     and_optab->handlers[(int) QImode].insn_code = CODE_FOR_andqi3;
  1933. #endif
  1934. #ifdef HAVE_andhi3
  1935.   if (HAVE_andhi3)
  1936.     and_optab->handlers[(int) HImode].insn_code = CODE_FOR_andhi3;
  1937. #endif
  1938. #ifdef HAVE_andpsi3
  1939.   if (HAVE_andpsi3)
  1940.     and_optab->handlers[(int) PSImode].insn_code = CODE_FOR_andpsi3;
  1941. #endif
  1942. #ifdef HAVE_andsi3
  1943.   if (HAVE_andsi3)
  1944.     and_optab->handlers[(int) SImode].insn_code = CODE_FOR_andsi3;
  1945. #endif
  1946. #ifdef HAVE_anddi3
  1947.   if (HAVE_anddi3)
  1948.     and_optab->handlers[(int) DImode].insn_code = CODE_FOR_anddi3;
  1949. #endif
  1950.   and_optab->handlers[(int) DImode].lib_call = "__anddi3";
  1951.  
  1952. #ifdef HAVE_andcbqi3
  1953.   if (HAVE_andcbqi3)
  1954.     andcb_optab->handlers[(int) QImode].insn_code = CODE_FOR_andcbqi3;
  1955. #endif
  1956. #ifdef HAVE_andcbhi3
  1957.   if (HAVE_andcbhi3)
  1958.     andcb_optab->handlers[(int) HImode].insn_code = CODE_FOR_andcbhi3;
  1959. #endif
  1960. #ifdef HAVE_andcbpsi3
  1961.   if (HAVE_andcbpsi3)
  1962.     andcb_optab->handlers[(int) PSImode].insn_code = CODE_FOR_andcbpsi3;
  1963. #endif
  1964. #ifdef HAVE_andcbsi3
  1965.   if (HAVE_andcbsi3)
  1966.     andcb_optab->handlers[(int) SImode].insn_code = CODE_FOR_andcbsi3;
  1967. #endif
  1968. #ifdef HAVE_andcbdi3
  1969.   if (HAVE_andcbdi3)
  1970.     andcb_optab->handlers[(int) DImode].insn_code = CODE_FOR_andcbdi3;
  1971. #endif
  1972.   andcb_optab->handlers[(int) DImode].lib_call = "__andcbdi3";
  1973.  
  1974. #ifdef HAVE_iorqi3
  1975.   if (HAVE_iorqi3)
  1976.     ior_optab->handlers[(int) QImode].insn_code = CODE_FOR_iorqi3;
  1977. #endif
  1978. #ifdef HAVE_iorhi3
  1979.   if (HAVE_iorhi3)
  1980.     ior_optab->handlers[(int) HImode].insn_code = CODE_FOR_iorhi3;
  1981. #endif
  1982. #ifdef HAVE_iorpsi3
  1983.   if (HAVE_iorpsi3)
  1984.     ior_optab->handlers[(int) PSImode].insn_code = CODE_FOR_iorpsi3;
  1985. #endif
  1986. #ifdef HAVE_iorsi3
  1987.   if (HAVE_iorsi3)
  1988.     ior_optab->handlers[(int) SImode].insn_code = CODE_FOR_iorsi3;
  1989. #endif
  1990. #ifdef HAVE_iordi3
  1991.   if (HAVE_iordi3)
  1992.     ior_optab->handlers[(int) DImode].insn_code = CODE_FOR_iordi3;
  1993. #endif
  1994.   ior_optab->handlers[(int) DImode].lib_call = "__iordi3";
  1995.  
  1996. #ifdef HAVE_xorqi3
  1997.   if (HAVE_xorqi3)
  1998.     xor_optab->handlers[(int) QImode].insn_code = CODE_FOR_xorqi3;
  1999. #endif
  2000. #ifdef HAVE_xorhi3
  2001.   if (HAVE_xorhi3)
  2002.     xor_optab->handlers[(int) HImode].insn_code = CODE_FOR_xorhi3;
  2003. #endif
  2004. #ifdef HAVE_xorpsi3
  2005.   if (HAVE_xorpsi3)
  2006.     xor_optab->handlers[(int) PSImode].insn_code = CODE_FOR_xorpsi3;
  2007. #endif
  2008. #ifdef HAVE_xorsi3
  2009.   if (HAVE_xorsi3)
  2010.     xor_optab->handlers[(int) SImode].insn_code = CODE_FOR_xorsi3;
  2011. #endif
  2012. #ifdef HAVE_xordi3
  2013.   if (HAVE_xordi3)
  2014.     xor_optab->handlers[(int) DImode].insn_code = CODE_FOR_xordi3;
  2015. #endif
  2016.   xor_optab->handlers[(int) DImode].lib_call = "__xordi3";
  2017.  
  2018. #ifdef HAVE_ashlqi3
  2019.   if (HAVE_ashlqi3)
  2020.     ashl_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashlqi3;
  2021. #endif
  2022. #ifdef HAVE_ashlhi3
  2023.   if (HAVE_ashlhi3)
  2024.     ashl_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashlhi3;
  2025. #endif
  2026. #ifdef HAVE_ashlpsi3
  2027.   if (HAVE_ashlpsi3)
  2028.     ashl_optab->handlers[(int) PSImode].insn_code = CODE_FOR_ashlpsi3;
  2029. #endif
  2030. #ifdef HAVE_ashlsi3
  2031.   if (HAVE_ashlsi3)
  2032.     ashl_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashlsi3;
  2033. #endif
  2034. #ifdef HAVE_ashldi3
  2035.   if (HAVE_ashldi3)
  2036.     ashl_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashldi3;
  2037. #endif
  2038.   ashl_optab->handlers[(int) SImode].lib_call = "__ashlsi3";
  2039.   ashl_optab->handlers[(int) DImode].lib_call = "__ashldi3";
  2040.  
  2041. #ifdef HAVE_ashrqi3
  2042.   if (HAVE_ashrqi3)
  2043.     ashr_optab->handlers[(int) QImode].insn_code = CODE_FOR_ashrqi3;
  2044. #endif
  2045. #ifdef HAVE_ashrhi3
  2046.   if (HAVE_ashrhi3)
  2047.     ashr_optab->handlers[(int) HImode].insn_code = CODE_FOR_ashrhi3;
  2048. #endif
  2049. #ifdef HAVE_ashrpsi3
  2050.   if (HAVE_ashrpsi3)
  2051.     ashr_optab->handlers[(int) PSImode].insn_code = CODE_FOR_ashrpsi3;
  2052. #endif
  2053. #ifdef HAVE_ashrsi3
  2054.   if (HAVE_ashrsi3)
  2055.     ashr_optab->handlers[(int) SImode].insn_code = CODE_FOR_ashrsi3;
  2056. #endif
  2057. #ifdef HAVE_ashrdi3
  2058.   if (HAVE_ashrdi3)
  2059.     ashr_optab->handlers[(int) DImode].insn_code = CODE_FOR_ashrdi3;
  2060. #endif
  2061.   ashr_optab->handlers[(int) SImode].lib_call = "__ashrsi3";
  2062.   ashr_optab->handlers[(int) DImode].lib_call = "__ashrdi3";
  2063.  
  2064. #ifdef HAVE_lshlqi3
  2065.   if (HAVE_lshlqi3)
  2066.     lshl_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshlqi3;
  2067. #endif
  2068. #ifdef HAVE_lshlhi3
  2069.   if (HAVE_lshlhi3)
  2070.     lshl_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshlhi3;
  2071. #endif
  2072. #ifdef HAVE_lshlpsi3
  2073.   if (HAVE_lshlpsi3)
  2074.     lshl_optab->handlers[(int) PSImode].insn_code = CODE_FOR_lshlpsi3;
  2075. #endif
  2076. #ifdef HAVE_lshlsi3
  2077.   if (HAVE_lshlsi3)
  2078.     lshl_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshlsi3;
  2079. #endif
  2080. #ifdef HAVE_lshldi3
  2081.   if (HAVE_lshldi3)
  2082.     lshl_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshldi3;
  2083. #endif
  2084.   lshl_optab->handlers[(int) SImode].lib_call = "__lshlsi3";
  2085.   lshl_optab->handlers[(int) DImode].lib_call = "__lshldi3";
  2086.  
  2087. #ifdef HAVE_lshrqi3
  2088.   if (HAVE_lshrqi3)
  2089.     lshr_optab->handlers[(int) QImode].insn_code = CODE_FOR_lshrqi3;
  2090. #endif
  2091. #ifdef HAVE_lshrhi3
  2092.   if (HAVE_lshrhi3)
  2093.     lshr_optab->handlers[(int) HImode].insn_code = CODE_FOR_lshrhi3;
  2094. #endif
  2095. #ifdef HAVE_lshrpsi3
  2096.   if (HAVE_lshrpsi3)
  2097.     lshr_optab->handlers[(int) PSImode].insn_code = CODE_FOR_lshrpsi3;
  2098. #endif
  2099. #ifdef HAVE_lshrsi3
  2100.   if (HAVE_lshrsi3)
  2101.     lshr_optab->handlers[(int) SImode].insn_code = CODE_FOR_lshrsi3;
  2102. #endif
  2103. #ifdef HAVE_lshrdi3
  2104.   if (HAVE_lshrdi3)
  2105.     lshr_optab->handlers[(int) DImode].insn_code = CODE_FOR_lshrdi3;
  2106. #endif
  2107.   lshr_optab->handlers[(int) SImode].lib_call = "__lshrsi3";
  2108.   lshr_optab->handlers[(int) DImode].lib_call = "__lshrdi3";
  2109.  
  2110. #ifdef HAVE_rotlqi3
  2111.   if (HAVE_rotlqi3)
  2112.     rotl_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotlqi3;
  2113. #endif
  2114. #ifdef HAVE_rotlhi3
  2115.   if (HAVE_rotlhi3)
  2116.     rotl_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotlhi3;
  2117. #endif
  2118. #ifdef HAVE_rotlpsi3
  2119.   if (HAVE_rotlpsi3)
  2120.     rotl_optab->handlers[(int) PSImode].insn_code = CODE_FOR_rotlpsi3;
  2121. #endif
  2122. #ifdef HAVE_rotlsi3
  2123.   if (HAVE_rotlsi3)
  2124.     rotl_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotlsi3;
  2125. #endif
  2126. #ifdef HAVE_rotldi3
  2127.   if (HAVE_rotldi3)
  2128.     rotl_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotldi3;
  2129. #endif
  2130.   rotl_optab->handlers[(int) SImode].lib_call = "__rotlsi3";
  2131.   rotl_optab->handlers[(int) DImode].lib_call = "__rotldi3";
  2132.  
  2133. #ifdef HAVE_rotrqi3
  2134.   if (HAVE_rotrqi3)
  2135.     rotr_optab->handlers[(int) QImode].insn_code = CODE_FOR_rotrqi3;
  2136. #endif
  2137. #ifdef HAVE_rotrhi3
  2138.   if (HAVE_rotrhi3)
  2139.     rotr_optab->handlers[(int) HImode].insn_code = CODE_FOR_rotrhi3;
  2140. #endif
  2141. #ifdef HAVE_rotrpsi3
  2142.   if (HAVE_rotrpsi3)
  2143.     rotr_optab->handlers[(int) PSImode].insn_code = CODE_FOR_rotrpsi3;
  2144. #endif
  2145. #ifdef HAVE_rotrsi3
  2146.   if (HAVE_rotrsi3)
  2147.     rotr_optab->handlers[(int) SImode].insn_code = CODE_FOR_rotrsi3;
  2148. #endif
  2149. #ifdef HAVE_rotrdi3
  2150.   if (HAVE_rotrdi3)
  2151.     rotr_optab->handlers[(int) DImode].insn_code = CODE_FOR_rotrdi3;
  2152. #endif
  2153.   rotr_optab->handlers[(int) SImode].lib_call = "__rotrsi3";
  2154.   rotr_optab->handlers[(int) DImode].lib_call = "__rotrdi3";
  2155.  
  2156. #ifdef HAVE_negqi2
  2157.   if (HAVE_negqi2)
  2158.     neg_optab->handlers[(int) QImode].insn_code = CODE_FOR_negqi2;
  2159. #endif
  2160. #ifdef HAVE_neghi2
  2161.   if (HAVE_neghi2)
  2162.     neg_optab->handlers[(int) HImode].insn_code = CODE_FOR_neghi2;
  2163. #endif
  2164. #ifdef HAVE_negpsi2
  2165.   if (HAVE_negpsi2)
  2166.     neg_optab->handlers[(int) PSImode].insn_code = CODE_FOR_negpsi2;
  2167. #endif
  2168. #ifdef HAVE_negsi2
  2169.   if (HAVE_negsi2)
  2170.     neg_optab->handlers[(int) SImode].insn_code = CODE_FOR_negsi2;
  2171. #endif
  2172. #ifdef HAVE_negdi2
  2173.   if (HAVE_negdi2)
  2174.     neg_optab->handlers[(int) DImode].insn_code = CODE_FOR_negdi2;
  2175. #endif
  2176. #ifdef HAVE_negsf2
  2177.   if (HAVE_negsf2)
  2178.     neg_optab->handlers[(int) SFmode].insn_code = CODE_FOR_negsf2;
  2179. #endif
  2180. #ifdef HAVE_negdf2
  2181.   if (HAVE_negdf2)
  2182.     neg_optab->handlers[(int) DFmode].insn_code = CODE_FOR_negdf2;
  2183. #endif
  2184.   neg_optab->handlers[(int) SImode].lib_call = "__negsi2"; 
  2185.   neg_optab->handlers[(int) DImode].lib_call = "__negdi2";
  2186.   neg_optab->handlers[(int) SFmode].lib_call = "__negsf2";
  2187.   neg_optab->handlers[(int) DFmode].lib_call = "__negdf2";
  2188.  
  2189. #ifdef HAVE_absqi2
  2190.   if (HAVE_absqi2)
  2191.     abs_optab->handlers[(int) QImode].insn_code = CODE_FOR_absqi2;
  2192. #endif
  2193. #ifdef HAVE_abshi2
  2194.   if (HAVE_abshi2)
  2195.     abs_optab->handlers[(int) HImode].insn_code = CODE_FOR_abshi2;
  2196. #endif
  2197. #ifdef HAVE_abspsi2
  2198.   if (HAVE_abspsi2)
  2199.     abs_optab->handlers[(int) PSImode].insn_code = CODE_FOR_abspsi2;
  2200. #endif
  2201. #ifdef HAVE_abssi2
  2202.   if (HAVE_abssi2)
  2203.     abs_optab->handlers[(int) SImode].insn_code = CODE_FOR_abssi2;
  2204. #endif
  2205. #ifdef HAVE_absdi2
  2206.   if (HAVE_absdi2)
  2207.     abs_optab->handlers[(int) DImode].insn_code = CODE_FOR_absdi2;
  2208. #endif
  2209. #ifdef HAVE_abssf2
  2210.   if (HAVE_abssf2)
  2211.     abs_optab->handlers[(int) SFmode].insn_code = CODE_FOR_abssf2;
  2212. #endif
  2213. #ifdef HAVE_absdf2
  2214.   if (HAVE_absdf2)
  2215.     abs_optab->handlers[(int) DFmode].insn_code = CODE_FOR_absdf2;
  2216. #endif
  2217.   /* No library calls here!  If there is no abs instruction,
  2218.      expand_expr will generate a conditional negation.  */
  2219.  
  2220. #ifdef HAVE_one_cmplqi2
  2221.   if (HAVE_one_cmplqi2)
  2222.     one_cmpl_optab->handlers[(int) QImode].insn_code = CODE_FOR_one_cmplqi2;
  2223. #endif
  2224. #ifdef HAVE_one_cmplhi2
  2225.   if (HAVE_one_cmplhi2)
  2226.     one_cmpl_optab->handlers[(int) HImode].insn_code = CODE_FOR_one_cmplhi2;
  2227. #endif
  2228. #ifdef HAVE_one_cmplpsi2
  2229.   if (HAVE_one_cmplpsi2)
  2230.     one_cmpl_optab->handlers[(int) PSImode].insn_code = CODE_FOR_one_cmplpsi2;
  2231. #endif
  2232. #ifdef HAVE_one_cmplsi2
  2233.   if (HAVE_one_cmplsi2)
  2234.     one_cmpl_optab->handlers[(int) SImode].insn_code = CODE_FOR_one_cmplsi2;
  2235. #endif
  2236. #ifdef HAVE_one_cmpldi2
  2237.   if (HAVE_one_cmpldi2)
  2238.     one_cmpl_optab->handlers[(int) DImode].insn_code = CODE_FOR_one_cmpldi2;
  2239. #endif
  2240.   one_cmpl_optab->handlers[(int) SImode].lib_call = "__one_cmplsi2"; 
  2241.   one_cmpl_optab->handlers[(int) DImode].lib_call = "__one_cmpldi2";
  2242.  
  2243. #ifdef HAVE_ffsqi2
  2244.   if (HAVE_ffsqi2)
  2245.     ffs_optab->handlers[(int) QImode].insn_code = CODE_FOR_ffsqi2;
  2246. #endif
  2247. #ifdef HAVE_ffshi2
  2248.   if (HAVE_ffshi2)
  2249.     ffs_optab->handlers[(int) HImode].insn_code = CODE_FOR_ffshi2;
  2250. #endif
  2251. #ifdef HAVE_ffspsi2
  2252.   if (HAVE_ffspsi2)
  2253.     ffs_optab->handlers[(int) PSImode].insn_code = CODE_FOR_ffspsi2;
  2254. #endif
  2255. #ifdef HAVE_ffssi2
  2256.   if (HAVE_ffssi2)
  2257.     ffs_optab->handlers[(int) SImode].insn_code = CODE_FOR_ffssi2;
  2258. #endif
  2259. #ifdef HAVE_ffsdi2
  2260.   if (HAVE_ffsdi2)
  2261.     ffs_optab->handlers[(int) DImode].insn_code = CODE_FOR_ffsdi2;
  2262. #endif
  2263.   ffs_optab->handlers[(int) SImode].lib_call = "ffs"; 
  2264.  
  2265. #ifdef HAVE_movqi
  2266.   if (HAVE_movqi)
  2267.     mov_optab->handlers[(int) QImode].insn_code = CODE_FOR_movqi;
  2268. #endif
  2269. #ifdef HAVE_movhi
  2270.   if (HAVE_movhi)
  2271.     mov_optab->handlers[(int) HImode].insn_code = CODE_FOR_movhi;
  2272. #endif
  2273. #ifdef HAVE_movpsi
  2274.   if (HAVE_movpsi)
  2275.     mov_optab->handlers[(int) PSImode].insn_code = CODE_FOR_movpsi;
  2276. #endif
  2277. #ifdef HAVE_movsi
  2278.   if (HAVE_movsi)
  2279.     mov_optab->handlers[(int) SImode].insn_code = CODE_FOR_movsi;
  2280. #endif
  2281. #ifdef HAVE_movdi
  2282.   if (HAVE_movdi)
  2283.     mov_optab->handlers[(int) DImode].insn_code = CODE_FOR_movdi;
  2284. #endif
  2285. #ifdef HAVE_movti
  2286.   if (HAVE_movti)
  2287.     mov_optab->handlers[(int) TImode].insn_code = CODE_FOR_movti;
  2288. #endif
  2289. #ifdef HAVE_movsf
  2290.   if (HAVE_movsf)
  2291.     mov_optab->handlers[(int) SFmode].insn_code = CODE_FOR_movsf;
  2292. #endif
  2293. #ifdef HAVE_movdf
  2294.   if (HAVE_movdf)
  2295.     mov_optab->handlers[(int) DFmode].insn_code = CODE_FOR_movdf;
  2296. #endif
  2297. #ifdef HAVE_movtf
  2298.   if (HAVE_movtf)
  2299.     mov_optab->handlers[(int) TFmode].insn_code = CODE_FOR_movtf;
  2300. #endif
  2301.  
  2302. #ifdef HAVE_movstrictqi
  2303.   if (HAVE_movstrictqi)
  2304.     movstrict_optab->handlers[(int) QImode].insn_code = CODE_FOR_movstrictqi;
  2305. #endif
  2306. #ifdef HAVE_movstricthi
  2307.   if (HAVE_movstricthi)
  2308.     movstrict_optab->handlers[(int) HImode].insn_code = CODE_FOR_movstricthi;
  2309. #endif
  2310. #ifdef HAVE_movstrictpsi
  2311.   if (HAVE_movstrictpsi)
  2312.     movstrict_optab->handlers[(int) PSImode].insn_code = CODE_FOR_movstrictpsi;
  2313. #endif
  2314. #ifdef HAVE_movstrictsi
  2315.   if (HAVE_movstrictsi)
  2316.     movstrict_optab->handlers[(int) SImode].insn_code = CODE_FOR_movstrictsi;
  2317. #endif
  2318. #ifdef HAVE_movstrictdi
  2319.   if (HAVE_movstrictdi)
  2320.     movstrict_optab->handlers[(int) DImode].insn_code = CODE_FOR_movstrictdi;
  2321. #endif
  2322.  
  2323. #ifdef HAVE_cmpqi
  2324.   if (HAVE_cmpqi)
  2325.     cmp_optab->handlers[(int) QImode].insn_code = CODE_FOR_cmpqi;
  2326. #endif
  2327. #ifdef HAVE_cmphi
  2328.   if (HAVE_cmphi)
  2329.     cmp_optab->handlers[(int) HImode].insn_code = CODE_FOR_cmphi;
  2330. #endif
  2331. #ifdef HAVE_cmppsi
  2332.   if (HAVE_cmppsi)
  2333.     cmp_optab->handlers[(int) PSImode].insn_code = CODE_FOR_cmppsi;
  2334. #endif
  2335. #ifdef HAVE_cmpsi
  2336.   if (HAVE_cmpsi)
  2337.     cmp_optab->handlers[(int) SImode].insn_code = CODE_FOR_cmpsi;
  2338. #endif
  2339. #ifdef HAVE_cmpdi
  2340.   if (HAVE_cmpdi)
  2341.     cmp_optab->handlers[(int) DImode].insn_code = CODE_FOR_cmpdi;
  2342. #endif
  2343. #ifdef HAVE_cmpsf
  2344.   if (HAVE_cmpsf)
  2345.     cmp_optab->handlers[(int) SFmode].insn_code = CODE_FOR_cmpsf;
  2346. #endif
  2347. #ifdef HAVE_cmpdf
  2348.   if (HAVE_cmpdf)
  2349.     cmp_optab->handlers[(int) DFmode].insn_code = CODE_FOR_cmpdf;
  2350. #endif
  2351. #ifdef HAVE_tstqi
  2352.   if (HAVE_tstqi)
  2353.     tst_optab->handlers[(int) QImode].insn_code = CODE_FOR_tstqi;
  2354. #endif
  2355. #ifdef HAVE_tsthi
  2356.   if (HAVE_tsthi)
  2357.     tst_optab->handlers[(int) HImode].insn_code = CODE_FOR_tsthi;
  2358. #endif
  2359. #ifdef HAVE_tstpsi
  2360.   if (HAVE_tstpsi)
  2361.     tst_optab->handlers[(int) SImode].insn_code = CODE_FOR_tstpsi;
  2362. #endif
  2363. #ifdef HAVE_tstsi
  2364.   if (HAVE_tstsi)
  2365.     tst_optab->handlers[(int) SImode].insn_code = CODE_FOR_tstsi;
  2366. #endif
  2367. #ifdef HAVE_tstdi
  2368.   if (HAVE_tstdi)
  2369.     tst_optab->handlers[(int) DImode].insn_code = CODE_FOR_tstdi;
  2370. #endif
  2371. #ifdef HAVE_tstsf
  2372.   if (HAVE_tstsf)
  2373.     tst_optab->handlers[(int) SFmode].insn_code = CODE_FOR_tstsf;
  2374. #endif
  2375. #ifdef HAVE_tstdf
  2376.   if (HAVE_tstdf)
  2377.     tst_optab->handlers[(int) DFmode].insn_code = CODE_FOR_tstdf;
  2378. #endif
  2379.   /* Comparison libcalls for integers MUST come in pairs, signed/unsigned.  */
  2380.   cmp_optab->handlers[(int) DImode].lib_call = "__cmpdi2";
  2381.   ucmp_optab->handlers[(int) DImode].lib_call = "__ucmpdi2";
  2382.   cmp_optab->handlers[(int) SFmode].lib_call = "__cmpsf2";
  2383.   cmp_optab->handlers[(int) DFmode].lib_call = "__cmpdf2";
  2384.  
  2385. #if defined( DSP56000 )
  2386. /* see comment in expr.c */
  2387. #if HAVE_bequ
  2388.   if (HAVE_bequ)
  2389.     bcc_gen_fctn[(int) EQU] = gen_bequ;
  2390. #endif
  2391. #endif
  2392. #if HAVE_beq
  2393.   if (HAVE_beq)
  2394.     bcc_gen_fctn[(int) EQ] = gen_beq;
  2395. #endif
  2396. #if defined( DSP56000 )
  2397. /* see comment in expr.c */
  2398. #if HAVE_bneu
  2399.   if (HAVE_bneu)
  2400.     bcc_gen_fctn[(int) NEU] = gen_bneu;
  2401. #endif
  2402. #endif
  2403. #if HAVE_bne
  2404.   if (HAVE_bne)
  2405.     bcc_gen_fctn[(int) NE] = gen_bne;
  2406. #endif
  2407. #if HAVE_bgt
  2408.   if (HAVE_bgt)
  2409.     bcc_gen_fctn[(int) GT] = gen_bgt;
  2410. #endif
  2411. #if HAVE_bge
  2412.   if (HAVE_bge)
  2413.     bcc_gen_fctn[(int) GE] = gen_bge;
  2414. #endif
  2415. #if HAVE_bgtu
  2416.   if (HAVE_bgtu)
  2417.     bcc_gen_fctn[(int) GTU] = gen_bgtu;
  2418. #endif
  2419. #if HAVE_bgeu
  2420.   if (HAVE_bgeu)
  2421.     bcc_gen_fctn[(int) GEU] = gen_bgeu;
  2422. #endif
  2423. #if HAVE_blt
  2424.   if (HAVE_blt)
  2425.     bcc_gen_fctn[(int) LT] = gen_blt;
  2426. #endif
  2427. #if HAVE_ble
  2428.   if (HAVE_ble)
  2429.     bcc_gen_fctn[(int) LE] = gen_ble;
  2430. #endif
  2431. #if HAVE_bltu
  2432.   if (HAVE_bltu)
  2433.     bcc_gen_fctn[(int) LTU] = gen_bltu;
  2434. #endif
  2435. #if HAVE_bleu
  2436.   if (HAVE_bleu)
  2437.     bcc_gen_fctn[(int) LEU] = gen_bleu;
  2438. #endif
  2439.  
  2440. #if defined( DSP56000 )
  2441. /* see comment in expr.c */
  2442. #if HAVE_sequ
  2443.   if (HAVE_sequ)
  2444.     setcc_gen_fctn[(int) EQU] = gen_sequ;
  2445. #endif
  2446. #endif
  2447. #if HAVE_seq
  2448.   if (HAVE_seq)
  2449.     setcc_gen_fctn[(int) EQ] = gen_seq;
  2450. #endif
  2451. #if defined( DSP56000 )
  2452. /* see comment in expr.c */
  2453. #if HAVE_sneu
  2454.   if (HAVE_sneu)
  2455.     setcc_gen_fctn[(int) NEU] = gen_sneu;
  2456. #endif
  2457. #endif
  2458. #if HAVE_sne
  2459.   if (HAVE_sne)
  2460.     setcc_gen_fctn[(int) NE] = gen_sne;
  2461. #endif
  2462. #if HAVE_sgt
  2463.   if (HAVE_sgt)
  2464.     setcc_gen_fctn[(int) GT] = gen_sgt;
  2465. #endif
  2466. #if HAVE_sge
  2467.   if (HAVE_sge)
  2468.     setcc_gen_fctn[(int) GE] = gen_sge;
  2469. #endif
  2470. #if HAVE_sgtu
  2471.   if (HAVE_sgtu)
  2472.     setcc_gen_fctn[(int) GTU] = gen_sgtu;
  2473. #endif
  2474. #if HAVE_sgeu
  2475.   if (HAVE_sgeu)
  2476.     setcc_gen_fctn[(int) GEU] = gen_sgeu;
  2477. #endif
  2478. #if HAVE_slt
  2479.   if (HAVE_slt)
  2480.     setcc_gen_fctn[(int) LT] = gen_slt;
  2481. #endif
  2482. #if HAVE_sle
  2483.   if (HAVE_sle)
  2484.     setcc_gen_fctn[(int) LE] = gen_sle;
  2485. #endif
  2486. #if HAVE_sltu
  2487.   if (HAVE_sltu)
  2488.     setcc_gen_fctn[(int) LTU] = gen_sltu;
  2489. #endif
  2490. #if HAVE_sleu
  2491.   if (HAVE_sleu)
  2492.     setcc_gen_fctn[(int) LEU] = gen_sleu;
  2493. #endif
  2494. }
  2495.